/* Fonts are served from this site (SIL Open Font License): Libre Caslon Text
   (a Caslon revival, the colonial American printer's face) for everything the
   site says, Libre Franklin (Franklin Gothic, Baltimore's own newspaper-era
   sans) for what people type. */
@font-face { font-family: 'Libre Caslon Text'; font-weight: 400; font-style: normal; font-display: swap; src: url('../fonts/libre-caslon-text-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Libre Caslon Text'; font-weight: 400; font-style: italic; font-display: swap; src: url('../fonts/libre-caslon-text-latin-400-italic.woff2') format('woff2'); }
@font-face { font-family: 'Libre Caslon Text'; font-weight: 700; font-style: normal; font-display: swap; src: url('../fonts/libre-caslon-text-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'Libre Franklin'; font-weight: 400; font-style: normal; font-display: swap; src: url('../fonts/libre-franklin-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Libre Franklin'; font-weight: 600; font-style: normal; font-display: swap; src: url('../fonts/libre-franklin-latin-600-normal.woff2') format('woff2'); }

:root {
    --serif: 'Libre Caslon Text', Georgia, 'Times New Roman', serif;
    --sans: 'Libre Franklin', 'Franklin Gothic Medium', Arial, Helvetica, sans-serif;
    --ink: #222;
    --ink-soft: #555;
    --rule: #ddd;
    --link: #1b4f8a;
    --field-edge: #8a8f94;
}

/* One step up from the browser's default size, for reading and for typing. */
html { font-size: 112.5%; }

body {
    font-family: var(--serif);
    line-height: 1.55;
    color: var(--ink);
    background: #fff;
    margin: 0;
    padding: 0;
}

h1, h2, h3 { line-height: 1.2; }
a { color: var(--link); }

nav {
    padding: 0.75rem 1.5rem;
    border-bottom: 1px solid #ddd;
}

nav a {
    margin-right: 1.5rem;
    color: #222;
    text-decoration: none;
}

nav a:hover {
    text-decoration: underline;
}

main {
    padding: 1.5rem;
    max-width: 960px;
    margin: 0 auto;
}

.tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}

.tile {
    display: block;
    padding: 1rem 1.25rem;
    border: 1px solid var(--tile-edge, #ddd);
    border-radius: 6px;
    background: var(--tile-bg, #fff);
    color: #222;
    text-decoration: none;
}

.tile:hover {
    border-color: #222;
    filter: brightness(0.96);
}

/* Very faint tints for the tiles, taken from the hues of Benjamin Moore's
   Mid-Century Modern palette (ochre, terra cotta, gray-blue, tan, peach).
   They are approximations of those hues, not Benjamin Moore's own values.
   Only the background changes: the black text stays as it was. */
.tile-blue  { --tile-bg: #e6edf1; --tile-edge: #cfdbe2; }   /* Wales Gray, Manor Blue */
.tile-sage  { --tile-bg: #eaeee1; --tile-edge: #d6ddc8; }   /* Old Prairie, Balboa Mist */
.tile-ochre { --tile-bg: #f8eed3; --tile-edge: #ebdcb2; }   /* Turmeric, Golden Mist */
.tile-peach { --tile-bg: #f9e8d8; --tile-edge: #eed3b9; }   /* Peach Parfait, Cancun Sand */
.tile-aqua  { --tile-bg: #e1efed; --tile-edge: #c8dedb; }   /* Lucerne, Cloud Cover */
.tile-clay  { --tile-bg: #f6e2d8; --tile-edge: #e8c9ba; }   /* Terra Cotta Tile */
.tile-rose  { --tile-bg: #f6e5e7; --tile-edge: #e7cbd0; }   /* Opulence */
.tile-stone { --tile-bg: #eee8df; --tile-edge: #dcd3c6; }   /* Woodstock Tan, Ashwood */

.tile-title {
    display: block;
    font-weight: bold;
    margin-bottom: 0.25rem;
}

.tile-note {
    display: block;
    font-size: 0.9rem;
    color: #555;
}

.messages {
    list-style: none;
    padding: 0;
    margin: 0 0 1rem;
}

.message {
    padding: 0.6rem 1rem;
    border: 1px solid #ddd;
    border-left-width: 4px;
    border-radius: 4px;
    margin-bottom: 0.5rem;
}

.message.success { border-left-color: #2e7d32; }
.message.warning { border-left-color: #b26a00; }
.message.error { border-left-color: #b00020; }

form .errorlist {
    color: #b00020;
    list-style: none;
    padding: 0;
    margin: 0.25rem 0;
}

form .helptext {
    display: block;
    font-size: 0.85rem;
    color: #555;
}

table.data {
    border-collapse: collapse;
    width: 100%;
    margin-top: 1rem;
}

table.data th, table.data td {
    text-align: left;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid #ddd;
    vertical-align: top;
}

table.data tr.inactive {
    color: #777;
}

.muted { color: #666; font-size: 0.9rem; }
.flag { color: #b00020; font-size: 0.9rem; }

.rooms {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
    margin: 0.75rem 0 1.5rem;
}

.room {
    padding: 0.85rem 1rem;
    border: 1px solid #ddd;
    border-radius: 6px;
}

.room.vacant {
    border-style: dashed;
    background: #fafafa;
}

.room span {
    display: block;
}

.room-name {
    font-weight: bold;
}

.room-status {
    margin: 0.35rem 0 0.15rem;
}

nav form.logout {
    display: inline;
}

nav form.logout button {
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    font: inherit;
    color: #222;
    cursor: pointer;
}

nav form.logout button:hover {
    text-decoration: underline;
}

dialog.notice {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 1.5rem 2rem;
    max-width: 22rem;
    text-align: center;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
}

dialog.notice::backdrop {
    background: rgba(0, 0, 0, 0.45);
}

dialog.notice h2 {
    margin-top: 0;
}

dialog.notice button {
    padding: 0.4rem 1.5rem;
    font: inherit;
    cursor: pointer;
}

.request { border-top: 1px solid #ccc; margin-top: 1.5rem; padding-top: 0.5rem; }
.request-photo { max-width: 160px; max-height: 160px; margin: 0.25rem; border: 1px solid #ccc; }

.thread { margin: 0.5rem 0 1rem; }
.post { border-left: 4px solid #999; padding: 0.1rem 0.75rem; margin: 0.6rem 0; background: #fafafa; }
.post.from-staff { border-left-color: #2e5d8f; }
.post.from-resident { border-left-color: #6a8f2e; }
.post-head { margin: 0.3rem 0 0; }
nav { display: flex; flex-wrap: wrap; align-items: center; }
nav .who { margin-left: auto; color: #555; font-size: 0.95em; }

.status-line { margin: 0.4rem 0; font-size: 0.92em; color: #333; border-left: 4px solid #ddd; padding-left: 0.75rem; }
.progress { list-style: none; display: flex; padding: 0; margin: 1rem 0 1.5rem; }
.step { flex: 1; text-align: center; position: relative; font-size: 0.85em; color: #888; padding: 0 0.15rem; }
.step::before { content: ""; position: absolute; top: 9px; left: -50%; width: 100%; height: 3px; background: #ccc; z-index: 0; }
.step:first-child::before { display: none; }
.step .dot { display: block; width: 20px; height: 20px; border-radius: 50%; background: #fff; border: 3px solid #ccc; margin: 0 auto 0.35rem; position: relative; z-index: 1; box-sizing: border-box; }
.step.done, .step.current { color: #222; }
.step.done::before, .step.current::before { background: #2e7d32; }
.step.done .dot { background: #2e7d32; border-color: #2e7d32; }
.step.current .dot { background: #fff; border-color: #2e7d32; box-shadow: 0 0 0 3px #cfe8d0; }
.step.current .step-label { font-weight: bold; }
.step-label, .step-date { display: block; }
.step-date { font-size: 0.85em; color: #666; min-height: 1.2em; }

/* Monthly Utilities */
.notice-box {
    padding: 0.6rem 1rem;
    border: 1px solid #ddd;
    border-left: 4px solid #b26a00;
    border-radius: 4px;
}

.utility-form input[type="number"], .utility-form input[type="text"] {
    width: 100%;
    max-width: 12rem;
    box-sizing: border-box;
}

.email-preview {
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 1rem;
    background: #fff;
    overflow-x: auto;
}

.inline-form { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }

/* Rent and Utilities */
.marker { display: inline-block; padding: 0.1rem 0.5rem; border-radius: 3px; font-size: 0.9rem; border: 1px solid #ccc; background: #f4f4f4; }
.marker.green { background: #e6f4e7; border-color: #2e7d32; color: #1b5e20; }
.marker.red { background: #fdecee; border-color: #b00020; color: #8a0019; font-weight: bold; }
.credit { color: #2e7d32; }
.ledger-form input[type="number"], .ledger-form input[type="text"] { max-width: 16rem; }

/* Operations Dashboard */
.chart-figure { margin: 1.5rem 0; padding: 0; }
.chart-figure figcaption { margin-bottom: 0.4rem; }
.chart-actions { margin: 0.25rem 0 0; font-size: 0.9rem; }
.chart svg { display: block; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; margin-top: 0.25rem; font-family: Arial, Helvetica, sans-serif; font-size: 12px; }
.chart-legend-item { display: inline-flex; align-items: center; gap: 0.35rem; }
.chart-swatch { display: inline-block; width: 12px; height: 12px; border-radius: 2px; }
.chart-description { margin: 0.4rem 0 0.2rem; font-size: 0.92rem; color: #444; max-width: 46rem; }
.signals ul { margin: 0.3rem 0 0; padding-left: 1.2rem; }
.range-controls { position: sticky; top: 0; z-index: 5; background: #fff; border-bottom: 1px solid #e3e3e3; padding: 0.4rem 0 0.2rem; margin: 0.5rem 0 1rem; font-size: 0.9rem; }
.control-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.9rem; margin: 0.15rem 0; }
.control-row button { font-size: 0.85rem; padding: 0.1rem 0.6rem; }
.control-row button.active { background: #333; color: #fff; }
#range-brush svg, .local-range svg { display: block; }
.local-range { margin: 0.3rem 0 0; }
.linklike { background: none; border: 0; padding: 0; color: #00e; text-decoration: underline; cursor: pointer; font: inherit; }
.event-notes ul { margin: 0.1rem 0 0.6rem; padding-left: 1.2rem; }
.event-title { margin: 0.5rem 0 0; }
.chart-figure { scroll-margin-top: 9rem; }
.local-range svg { max-width: 760px; }

/* Phones: wide tables scroll inside themselves, never the page; the signed-in
   line drops to its own row instead of wrapping beside the links. */
@media (max-width: 640px) {
    main table { display: block; max-width: 100%; overflow-x: auto; }
    main select, main textarea, main input { max-width: 100%; box-sizing: border-box; }
    .step { min-width: 0; font-size: 0.62em; padding: 0; overflow-wrap: anywhere; }
}

/* ---- Forms: serif labels, sans entries, slightly larger than usual ---- */
main form p { margin: 0 0 1rem; }
main form label { display: block; margin-bottom: 0.25rem; }
main form input[type="checkbox"] + label, main form label:has(input[type="checkbox"]) { display: inline; }
input, select, textarea, button { font: inherit; }
main input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="submit"]),
main select, main textarea {
    font-family: var(--sans);
    font-size: 1rem;
    padding: 0.45rem 0.6rem;
    border: 1px solid var(--field-edge);
    border-radius: 4px;
    background: #fff;
    color: var(--ink);
    box-sizing: border-box;
    max-width: 100%;
}
main input:focus, main select:focus, main textarea:focus {
    outline: 2px solid var(--link);
    outline-offset: 1px;
}
main input[type="file"] { font-family: var(--sans); font-size: 0.9rem; }
main form button[type="submit"], main button.button {
    font-family: var(--sans);
    font-weight: 600;
    padding: 0.5rem 1.25rem;
    border: 1px solid var(--ink);
    border-radius: 4px;
    background: var(--ink);
    color: #fff;
    cursor: pointer;
}
main form button[type="submit"]:hover { background: #000; }

/* ---- Public pages ---- */
.cover { margin: 2.5rem 0 1.5rem; }
.cover h1 {
    font-size: clamp(2.6rem, 8vw, 5.25rem);
    line-height: 1.02;
    letter-spacing: -0.01em;
    margin: 0 0 0.75rem;
    max-width: 14ch;
}
.cover .place { font-style: italic; font-size: 1.3rem; color: var(--ink-soft); margin: 0; }

.site-footer {
    max-width: 960px;
    margin: 3rem auto 0;
    padding: 1rem 1.5rem 2rem;
    border-top: 1px solid var(--rule);
    color: var(--ink-soft);
    font-size: 0.85rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1.5rem;
    justify-content: space-between;
}
.site-footer a { color: var(--ink-soft); }

/* ---- Facts: bold label, colon, value wrapping inside its own cell ---- */
dl.facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 0.35rem 0.75rem; margin: 0.5rem 0 1.5rem; }
dl.facts dt { font-weight: bold; }
dl.facts dt::after { content: ":"; }
dl.facts dd { margin: 0; overflow-wrap: anywhere; }

/* ---- Request cards on the resident list: two light grays in turn ---- */
.request-card { border-radius: 10px; padding: 0.75rem 1.25rem 0.5rem; margin: 1rem 0; background: #f3f3f1; }
.request-card:nth-of-type(even) { background: #e9e9e6; }
.request-card h2 { margin: 0.25rem 0; }

/* ---- Suggestion box: label above, entry below, about a third of the page ---- */
.suggestion-form textarea { width: 30%; min-width: 20rem; }
@media (max-width: 640px) {
    .suggestion-form textarea { width: 100%; min-width: 0; }
}

/* ---- Portal identity: a colored frame around every page of a portal ----
   Red for the landlord portal (property managers share it), blue for the
   residents' portal. The public site has none. */
body.portal {
    --portal: #b3261e;
    margin: 0.6rem;
    border: 4px solid var(--portal);
    border-radius: 14px;
    min-height: calc(100vh - 1.2rem);
    box-sizing: border-box;
    /* No overflow:hidden here: on <body> it would be handed to the window and switch the page scrollbar off. */
}
body.portal-residents { --portal: #1f5fa8; }
body.portal nav { border-bottom-color: var(--portal); }
body.portal .site-footer { border-top-color: var(--portal); }

/* ---- Login panel ---- */
.login-panel {
    max-width: 26rem;
    margin: 2.5rem auto;
    padding: 1.75rem 2rem 1.5rem;
    border: 2px solid var(--portal, var(--ink));
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.10);
    font-size: 1.1rem;
}
.login-panel h1 { font-size: 1.6rem; margin-top: 0; color: var(--portal); }
.login-panel input:not([type="checkbox"]) { width: 100%; font-size: 1.1rem; }
.login-panel button[type="submit"] { background: var(--portal); border-color: var(--portal); width: 100%; font-size: 1.05rem; }
.login-panel p:last-child { margin-bottom: 0; text-align: center; }
@media (max-width: 640px) {
    body.portal { margin: 0.4rem; border-width: 3px; min-height: calc(100vh - 0.8rem); }
    .login-panel { margin: 1.25rem 0.25rem; padding: 1.25rem 1.1rem; }
}

/* ---- Landlord home: tiles in groups divided by a thin line ---- */
.tile-group { border-top: 1px solid var(--rule); margin-top: 1.5rem; padding-top: 0.75rem; }
.tile-group:first-of-type { border-top: 0; margin-top: 0.5rem; }
.tile-group h2 { font-size: 1.1rem; margin: 0; color: var(--ink-soft); font-weight: 400; font-style: italic; }
.tile-group .tiles { margin-top: 0.75rem; }

/* ---- Navigation: links in a row on wide screens; on phones a round burger
   button slides a drawer of large, finger-sized links in from the side.
   Pure CSS (a hidden checkbox), so it works without scripts. ---- */
nav { gap: 0.5rem; }
.nav-links { display: flex; flex: 1; flex-wrap: wrap; align-items: center; }
.nav-brand, .nav-toggle, .burger, .nav-scrim { display: none; }

@media (max-width: 640px) {
    nav { padding: 0.5rem 1rem; justify-content: space-between; min-height: 3.25rem; }
    .nav-brand { display: inline-block; margin: 0; font-weight: bold; }
    .nav-toggle { display: block; position: absolute; opacity: 0; width: 1px; height: 1px; }
    .burger {
        display: flex; align-items: center; justify-content: center;
        width: 2.9rem; height: 2.9rem; border-radius: 50%;
        border: 2px solid var(--portal, var(--ink)); background: #fff;
        cursor: pointer; position: relative; z-index: 40;
    }
    .burger span, .burger span::before, .burger span::after {
        display: block; width: 1.3rem; height: 2px; background: var(--portal, var(--ink)); position: relative;
        transition: transform 0.2s, background 0.2s;
    }
    .burger span::before, .burger span::after { content: ""; position: absolute; left: 0; }
    .burger span::before { top: -0.4rem; }
    .burger span::after { top: 0.4rem; }
    .nav-toggle:checked ~ .burger span { background: transparent; }
    .nav-toggle:checked ~ .burger span::before { transform: translateY(0.4rem) rotate(45deg); }
    .nav-toggle:checked ~ .burger span::after { transform: translateY(-0.4rem) rotate(-45deg); }
    .nav-toggle:focus-visible ~ .burger { outline: 2px solid var(--link); outline-offset: 2px; }
    .nav-scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.4); z-index: 20; }
    .nav-toggle:checked ~ .nav-scrim { display: block; }
    .nav-links {
        position: fixed; top: 0; right: 0; bottom: 0; z-index: 30;
        width: min(82vw, 20rem); box-sizing: border-box;
        background: #fff; border-left: 4px solid var(--portal, var(--ink));
        flex-direction: column; align-items: stretch; flex-wrap: nowrap; justify-content: flex-start;
        padding: 4.5rem 1.25rem 1.5rem; overflow-y: auto;
        transform: translateX(105%); transition: transform 0.22s ease-out; visibility: hidden;
    }
    .nav-toggle:checked ~ .nav-links { transform: none; visibility: visible; }
    .nav-links a, nav form.logout button {
        display: block; margin: 0; padding: 0.9rem 0.5rem; min-height: 1.5rem;
        font-size: 1.3rem; border-bottom: 1px solid var(--rule); text-align: left; width: 100%; box-sizing: border-box;
    }
    nav form.logout { display: block; }
    nav form.logout button { font-family: var(--serif); }
    .nav-links .who { order: -1; margin: 0 0 0.75rem; font-size: 0.9rem; }
}

.eyebrow { display: block; font-size: 0.5em; font-weight: 400; font-style: italic; color: var(--ink-soft); letter-spacing: 0.02em; }

.request.implemented { color: #8a8a8a; background: #f5f5f4; border-radius: 8px; padding-left: 1rem; padding-right: 1rem; }
.request.implemented .muted { color: #8a8a8a; }

/* Mini progress bar in the landlord request table */
.mini-progress { display: inline-flex; gap: 2px; vertical-align: middle; margin-right: 0.5rem; }
.mini-progress i { display: block; width: 0.9rem; height: 0.55rem; border-radius: 2px; background: #d6d6d3; }
.mini-progress i.on { background: #2e7d32; }
.mini-label { font-size: 0.85rem; color: var(--ink-soft); }

/* ---- "You are logged in" chip and notice: same red/blue as the portal frames ---- */
nav .who { display: inline-flex; align-items: center; gap: 0.75rem; flex-wrap: wrap;
    border: 2px solid var(--portal, var(--rule)); border-radius: 8px; padding: 0.2rem 0.4rem 0.2rem 0.75rem;
    background: #fff; color: var(--ink); }
nav .who-text { font-size: 0.9rem; }
nav .who form.logout button { font-family: var(--sans); font-weight: 600; font-size: 0.85rem;
    padding: 0.3rem 0.8rem; border-radius: 5px; background: var(--portal, var(--ink)); color: #fff; border: 0; }
nav .who form.logout button:hover { text-decoration: none; filter: brightness(0.9); }

/* The public site's version of the chip: same colors, in the nav's corner. */
nav .who-landlord { --portal: #b3261e; }
nav .who-residents { --portal: #1f5fa8; }
nav .who a { font-family: var(--sans); font-weight: 600; font-size: 0.85rem; padding: 0.3rem 0.8rem;
    border-radius: 5px; text-decoration: none; margin: 0; }
nav .who a.who-link { border: 1px solid var(--portal); color: var(--portal); background: #fff; }
nav .who a.who-logout { background: var(--portal); color: #fff; border: 1px solid var(--portal); }
nav .who a.who-logout:hover { filter: brightness(0.9); text-decoration: none; }
@media (max-width: 640px) {
    .nav-links .who { order: -1; margin: 0 0 0.75rem; border-radius: 8px; }
    .nav-links .who form.logout { display: block; width: 100%; }
    .nav-links .who a { display: block; width: 100%; text-align: center; box-sizing: border-box; padding: 0.7rem; font-size: 1.1rem; border-bottom-width: 1px; }
    .nav-links .who form.logout button { width: 100%; text-align: center; border-bottom: 0; font-size: 1.1rem; padding: 0.7rem; }
}

/* ---- Emergency notice on the maintenance request page ---- */
.emergency-notice { display: grid; grid-template-rows: 1fr; opacity: 1; margin: 1rem 0;
    transition: grid-template-rows 0.7s ease, opacity 0.7s ease, margin 0.7s ease; }
.emergency-notice.pending { grid-template-rows: 0fr; opacity: 0; margin: 0; }
.emergency-notice.pending .emergency-inner { border-width: 0; }
.emergency-inner { overflow: hidden; min-height: 0; background: #fdecec; border: 2px solid #c0392b;
    border-radius: 10px; padding: 0 1.25rem; transition: border-width 0.7s ease; }
.emergency-notice:not(.pending) .emergency-inner { padding-top: 0.75rem; padding-bottom: 0.75rem; }
.emergency-label { margin: 0 0 0.25rem; font-family: var(--sans); font-weight: 600; font-size: 0.85rem;
    letter-spacing: 0.12em; text-transform: uppercase; color: #a5281b; }
.emergency-inner p { margin: 0; }
.emergency-inner a { color: #a5281b; font-weight: bold; white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { .emergency-notice { transition: none; } }

/* ---- Landlord's preview of the resident portal: purple ---- */
body.portal-preview { --portal: #6b3fa0; }
.preview-bar { background: #f1eaf9; border-bottom: 2px solid #6b3fa0; color: #46266b; padding: 0.4rem 1.5rem; font-size: 0.9rem; }
.tile-lilac { --tile-bg: #efe8f7; --tile-edge: #d9c9ec; }
