/* Sherman Housing Authority — layout follows planoha.org (with permission),
   in SHA's maroon instead of Plano's orange. */
:root {
  --brand: #7a1f2b;        /* SHA maroon */
  --brand-dark: #5c1520;
  --brand-light: #a3404d;
  --ink: #2b2b2b;
  --ink-soft: #444343;
  --line: #e2e2e2;
  --page-bg: #ffffff;
  --panel: #ffffff;
  --todo-bg: #fff4c2;
  --todo-line: #d9b100;
  --heading: "Arvo", Georgia, serif;
  --body: "Merriweather Sans", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { font-size: 16px; }
body {
  margin: 0;
  background: var(--page-bg);
  color: var(--ink);
  font-family: var(--body);
  font-size: 0.95rem;
  line-height: 1.6;
}
img { max-width: 100%; height: auto; }
a { color: var(--brand); }
a:hover { color: var(--brand-dark); }
h1, h2, h3, h4 { font-family: var(--heading); color: var(--ink-soft); line-height: 1.3; }
:focus-visible { outline: 3px solid #1a5fb4; outline-offset: 2px; }

.wrap { width: min(1200px, 100% - 32px); margin-inline: auto; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.skip { position: absolute; left: -999px; top: 0; background: #fff; padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; }

/* Draft placeholders: anything SHA still has to confirm. Remove before launch. */
.todo {
  background: var(--todo-bg);
  color: #3a3000;
  border: 1px dashed var(--todo-line);
  padding: 1px 6px;
  border-radius: 3px;
}
p.todo, div.todo { display: block; padding: 10px 12px; }

/* Alert bar */
.alertbar { background: var(--brand); color: #fff; }
.alertbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 8px 0; }
.alertbar p { margin: 0; font-size: 0.82rem; font-weight: 700; text-align: center; flex: 1; }
.alert-btn {
  color: #fff; background: var(--brand-dark); padding: 4px 18px; border-radius: 2px;
  font-family: var(--heading); font-size: 0.85rem; text-decoration: none; white-space: nowrap;
}
.alert-btn:hover { color: #fff; background: #3e0e15; }

/* Page panel */
.page { background: var(--panel); width: 100%; }

/* Header */
.header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 28px 0 20px; flex-wrap: wrap; }
.logo { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.logo-text { display: flex; flex-direction: column; line-height: 1; }
.logo-big { font-family: var(--heading); font-size: 2rem; font-weight: 700; color: var(--brand); text-transform: uppercase; letter-spacing: 0.02em; }
.logo-small { font-family: var(--heading); font-size: 0.95rem; color: var(--ink-soft); letter-spacing: 0.04em; padding-top: 4px; border-top: 2px solid var(--brand); margin-top: 4px; }
.header-right { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.phone { font-size: 1.1rem; font-weight: 700; color: #3d3d3d; text-decoration: none; padding-left: 22px; position: relative; }
.phone::before { content: "\260E"; position: absolute; left: 0; color: var(--brand); }
.header-btns { display: flex; gap: 8px; }
.btn {
  display: inline-block; font-family: var(--heading); font-size: 0.85rem; text-decoration: none;
  padding: 6px 14px; border: 1px solid var(--brand); color: var(--brand); border-radius: 2px; background: #fff;
}
.btn:hover { background: #f6eced; }
.btn-solid { background: var(--brand); color: #fff; }
.btn-solid:hover { background: var(--brand-dark); color: #fff; }

/* Menu: dashed rules above and below, as on Plano */
.menu { border-top: 1px dashed #c9c9c9; border-bottom: 1px dashed #c9c9c9; padding: 6px 0; }
.menu ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0 4px; }
.menu a {
  display: block; padding: 7px 12px; font-family: var(--heading); font-size: 0.92rem;
  color: #000; text-decoration: none; border-radius: 2px;
}
.menu a:hover, .menu a[aria-current="page"] { background: var(--brand); color: #fff; }
.menu-toggle { display: none; }

/* Main */
.main { padding: 24px 0 32px; min-height: 40vh; }
.page-title { font-size: 1.6rem; margin: 0 0 16px; padding-bottom: 8px; border-bottom: 2px solid var(--brand); }
.main h2 { font-size: 1.2rem; margin: 28px 0 8px; }
.main h3 { font-size: 1.05rem; margin: 20px 0 6px; }
.lead { font-size: 1.02rem; }
.rule { border-left: 4px solid var(--brand); background: #f7f1f2; padding: 10px 14px; margin: 16px 0; }

/* Home: hero + feature boxes + sidebar */
.hero-band { background: #1f3f78; margin-top: 16px; }
.hero {
  padding: 32px 0; display: grid; grid-template-columns: auto 1fr;
  gap: 28px; align-items: center; color: #fff;
}
.hero-img { display: block; width: 385px; max-width: 100%; border: 4px solid #fff; }
.hero-kicker { margin: 0 0 4px; font-size: 0.85rem; letter-spacing: 0.05em; text-transform: uppercase; color: #dbe6f7; }
.hero-title { margin: 0 0 10px; font-size: 1.7rem; color: #fff; }
.hero-text p { margin: 0 0 12px; }
.hero-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.btn-light { background: #fff; color: var(--brand); border-color: #fff; }
.btn-light:hover { background: #f6eced; color: var(--brand-dark); }
.hero .btn-solid { border-color: #fff; }
.home-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 32px; margin-top: 24px; }
.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.feature h2 { font-size: 1.05rem; margin: 0 0 8px; }
.feature p { font-size: 0.85rem; margin: 0 0 12px; }
.readmore {
  display: inline-block; background: var(--brand); color: #fff; border: 1px solid var(--brand-light);
  font-family: var(--heading); font-size: 0.78rem; padding: 6px 12px; text-decoration: none; border-radius: 2px;
}
.readmore:hover { background: var(--brand-dark); color: #fff; }
.sidebar h2 { font-size: 1.05rem; margin: 0 0 12px; padding-bottom: 6px; border-bottom: 2px solid var(--brand); }
.sidebar .btn { margin: 4px 0; }

/* Lists of links (forms, notices) */
.linklist { list-style: none; padding: 0; margin: 0; }
.linklist li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.linklist .note { display: block; font-size: 0.82rem; color: #555; }

/* Tables */
table { border-collapse: collapse; width: 100%; margin: 12px 0; font-size: 0.9rem; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-family: var(--heading); color: var(--ink-soft); background: #f5f5f5; }

/* FAQ */
details { border-bottom: 1px solid var(--line); padding: 10px 0; }
summary { cursor: pointer; font-family: var(--heading); color: var(--ink-soft); }
details p { margin: 8px 0 0; }

/* Forms (search, booking) */
input, select, textarea, button { font: inherit; }
.field { display: grid; gap: 4px; margin-bottom: 12px; max-width: 420px; }
.field input, .field select, .field textarea { padding: 8px; border: 1px solid #aaa; border-radius: 2px; }

/* HUD strip, footer */
.hud-strip { display: flex; gap: 16px; align-items: center; padding: 20px 0 28px; }
.hud-strip h2 { margin: 0 0 4px; font-size: 1.05rem; }
.hud-strip p { margin: 0; }
.quote-mark {
  display: grid; place-items: center; width: 44px; height: 44px; flex: none;
  background: var(--brand); color: #fff; font-family: var(--heading); font-size: 2rem; border-radius: 4px;
}
.footer { background: linear-gradient(180deg, var(--brand-light), var(--brand-dark)); color: #f2f2f2; }
.footer a { color: #fff; }
.footer-cols { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; padding: 28px 0 8px; }
.footer h2 {
  color: #f2f2f2; font-size: 1.15rem; margin: 0 0 12px; padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.35);
}
.footer p { font-size: 0.8rem; margin: 0 0 10px; }
.search { display: flex; gap: 4px; }
.search input { flex: 1; min-width: 0; padding: 6px 8px; border: 0; border-radius: 2px; }
.search button { border: 0; background: var(--brand-dark); color: #fff; padding: 6px 10px; border-radius: 2px; cursor: pointer; }
.eeo { border-top: 1px solid rgba(255, 255, 255, 0.25); padding: 14px 0; }
.eeo p { font-size: 0.72rem; margin: 0; display: flex; gap: 12px; align-items: flex-start; }
.eeo img { flex: none; }
.footer-bottom { background: rgba(0, 0, 0, 0.25); }
.footer-bottom-inner { display: flex; justify-content: space-between; padding: 10px 0; font-size: 0.8rem; }

/* Phones */
@media (max-width: 760px) {
  .alertbar-inner { flex-direction: column; gap: 6px; }
  .header { justify-content: center; text-align: center; }
  .header-right { align-items: center; width: 100%; }
  .menu-toggle {
    display: block; width: 100%; padding: 10px; background: var(--brand); color: #fff;
    border: 0; font-family: var(--heading); font-size: 1rem; cursor: pointer;
  }
  .menu ul { display: none; flex-direction: column; }
  .menu ul.open { display: flex; }
  .home-grid, .features, .footer-cols { grid-template-columns: 1fr; }
  .hero { grid-template-columns: 1fr; padding: 16px 0; gap: 16px; }
  .hero-img { width: 100%; }
  .hero-title { font-size: 1.4rem; }
  table { display: block; overflow-x: auto; }
}

/* Demo builds only (python3 build.py --demo): a slim strip above everything, label in the top-right corner */
.demo-badge {
  background: #ffcc00; color: #1a1a1a; border-bottom: 2px solid #1a1a1a;
  padding: 4px 16px; text-align: right; font-family: var(--heading); font-weight: 700; font-size: 0.95rem;
}
.demo-badge span { font-family: var(--body); font-weight: 400; font-size: 0.8rem; margin-left: 8px; }

/* Assistant chat bubble (bottom-left): round portrait, glow on hover, greeting bubble */
.agent-launcher { position: fixed; left: 18px; bottom: 18px; z-index: 900; display: flex; align-items: center; gap: 10px; }
.agent-toggle {
  width: 72px; height: 72px; padding: 0; border-radius: 50%; overflow: hidden; cursor: pointer;
  border: 3px solid #fff; background: var(--brand);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3); transition: box-shadow 0.25s ease, transform 0.25s ease;
}
.agent-toggle img { display: block; width: 100%; height: 100%; object-fit: cover; }
.agent-toggle:hover, .agent-toggle:focus-visible {
  transform: scale(1.05);
  box-shadow: 0 0 0 6px rgba(163, 64, 77, 0.35), 0 0 24px 8px rgba(255, 204, 0, 0.55);
}
.agent-tip {
  background: #fff; color: var(--ink); border: 1px solid #ccc; border-radius: 14px;
  padding: 8px 12px; font-size: 0.9rem; white-space: nowrap; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  opacity: 0; transform: translateX(-6px); transition: opacity 0.2s ease, transform 0.2s ease; pointer-events: none;
}
.agent-toggle:hover + .agent-tip, .agent-toggle:focus-visible + .agent-tip { opacity: 1; transform: none; }
.agent-launcher.is-open .agent-tip { display: none; }
@media (prefers-reduced-motion: reduce) { .agent-toggle, .agent-tip { transition: none; } .agent-toggle:hover { transform: none; } }

.agent-panel:not([hidden]) {
  position: fixed; left: 16px; bottom: 102px; z-index: 900;
  width: min(410px, 100vw - 32px); height: min(620px, 100vh - 124px);
  display: flex; flex-direction: column; background: #fff;
  border-radius: 14px; overflow: hidden; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}
.agent-head { display: flex; align-items: center; gap: 12px; background: var(--brand); color: #fff; padding: 12px 14px; }
.agent-head-img { width: 52px; height: 52px; border-radius: 50%; object-fit: cover; border: 2px solid #fff; flex: none; }
.agent-who { flex: 1; }
.agent-name { margin: 0; font-family: var(--heading); font-weight: 700; font-size: 1.1rem; color: #fff; }
.agent-ai { display: inline-block; background: #fff; color: var(--brand); font-family: var(--body); font-size: 0.7rem; font-weight: 700; border-radius: 4px; padding: 1px 5px; vertical-align: middle; }
.agent-role { margin: 0; font-size: 0.85rem; color: #f3dfe2; }
.agent-close { width: 34px; height: 34px; background: #fff; color: var(--brand); border: 0; border-radius: 6px; font-size: 1.4rem; line-height: 1; cursor: pointer; flex: none; }
.agent-log { flex: 1; overflow-y: auto; padding: 14px; }
.agent-msg { margin: 0 0 12px; padding: 10px 12px; border-radius: 12px; font-size: 0.95rem; line-height: 1.5; white-space: pre-wrap; }
.agent-bot { background: #f3f3f3; margin-right: 24px; }
.agent-you { background: #f6eced; margin-left: 40px; }
.agent-form { display: flex; gap: 8px; padding: 10px 14px; border-top: 1px solid #e3e3e3; }
.agent-form input { flex: 1; min-width: 0; padding: 10px 12px; border: 1px solid #bbb; border-radius: 20px; background: #f7f7f9; }
.agent-form button { background: var(--brand); color: #fff; border: 0; border-radius: 20px; padding: 10px 16px; cursor: pointer; }
.agent-form button:disabled { opacity: 0.6; }
.agent-note { margin: 0; padding: 6px 14px 10px; font-size: 0.72rem; color: #555; text-align: center; }

/* Live calendar and document lists (filled by public-data.js) */
.event-list { list-style: none; padding: 0; margin: 0 0 8px; }
.event-list li { padding: 10px 0; border-bottom: 1px solid var(--line); display: grid; gap: 2px; }
.event-date { font-family: var(--heading); color: var(--brand); font-size: 0.9rem; }
.event-title { font-size: 1rem; }
.event-details, .event-notes { font-size: 0.88rem; color: #444; }
.data-empty { color: #555; font-style: italic; }

/* Document viewer page (/document/?id=...) */
.doc-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 8px; }
.doc-date { color: #555; margin: 0 0 12px; }
.doc-frame { width: 100%; height: min(1100px, 85vh); border: 1px solid #ccc; border-radius: 4px; background: #f4f4f4; }
.doc-image { display: block; max-width: 100%; border: 1px solid #ccc; }
.doc-note { font-size: 0.85rem; color: #555; }

.rule-spam { border-left-color: #c98a00; background: #fff8e6; }
/* Strong warning (recertification: wait until the office contacts you). Red edge and heading, dark text. */
.rule-warn { border-left: 6px solid #b00020; background: #fdecee; padding: 12px 16px; }
.rule-warn strong { display: block; color: #b00020; font-size: 1.1rem; margin-bottom: 4px; }
.choice-asked { font-weight: 700; }

/* Home page meeting banner (shown until the meeting day ends) */
.meeting-banner:not([hidden]) {
  display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin: 0 0 14px;
  padding: 8px 14px; background: #fff; color: var(--ink); border-left: 5px solid #ffcc00; border-radius: 4px;
  text-decoration: none; font-size: 0.92rem; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}
.meeting-banner:hover, .meeting-banner:focus-visible { background: #fff8e0; }

/* Applications open/closed wording: only one of each pair shows (public-data.js). */
[data-apps][hidden], [data-wo][hidden] { display: none !important; }
.btn-disabled { opacity: 0.55; cursor: default; }

/* Home page notices (applications closed, Section 8) */
.hero-notice { margin: 0 0 14px; padding: 10px 14px; background: #fff; color: var(--ink); border-left: 5px solid #ffcc00; border-radius: 4px; font-size: 0.92rem; }
.hero-text .hero-notice p { margin: 0 0 6px; }
.hero-text .hero-notice p:last-child { margin: 0; }
.hero-notice a { color: var(--brand); }
.meeting-label { font-weight: 700; color: var(--brand); }
.meeting-when { color: var(--ink); }
.meeting-link { color: var(--brand); text-decoration: underline; }

/* Pest control address lookup (Calendars page) */
.pest-lookup { background: #f3f6fa; border: 1px solid #d6dee8; border-left: 4px solid var(--brand); border-radius: 6px; padding: 16px; margin: 12px 0 16px; max-width: 640px; }
.pest-lookup label { display: block; font-weight: 700; margin-bottom: 6px; }
.pest-lookup input { width: 100%; font-size: 1.05rem; padding: 10px 12px; border: 1px solid #9aa7b5; border-radius: 4px; box-sizing: border-box; }
.pest-result:empty { display: none; }
.pest-result { margin-top: 12px; }
.pest-result p { margin: 4px 0; }
.pest-group strong { font-size: 1.15rem; color: var(--brand); }
.pest-next { font-size: 1.05rem; }
.pest-more, .pest-ready, .pest-hint { color: #444; }

/* Online forms (grievance) */
.online-form { margin-top: 20px; }
.online-form fieldset { border: 1px solid var(--line); border-radius: 4px; padding: 12px 16px 6px; margin: 0 0 16px; }
.online-form legend { font-family: var(--heading); font-weight: 700; padding: 0 6px; }
.online-form .field { max-width: 520px; }
.online-form .field-wide { max-width: 100%; }
.online-form .field input, .online-form .field select, .online-form .field textarea { border-radius: 4px; border-color: #9aa7b5; }
.online-form textarea { resize: vertical; }
.choice { display: flex; gap: 8px; align-items: flex-start; margin: 0 0 10px; }
.choice input { margin-top: 0.3em; flex: none; }
.choice-inline { display: inline-flex; margin-right: 18px; }
.online-form .q { margin: 0 0 12px; }
.online-form .q-text { margin: 0 0 6px; font-weight: 700; }
.online-form .note { font-size: 0.9rem; color: #555; }
.row-block { border-top: 1px dashed var(--line); padding-top: 10px; margin-top: 10px; }
.row-title { font-family: var(--heading); font-weight: 700; margin: 0 0 8px; }
.online-form [data-add] { margin: 4px 0 14px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.form-error { color: #a4161a; font-weight: 700; min-height: 1em; }
.form-done { border-left: 4px solid #2e7d32; background: #eef7ee; padding: 14px 16px; margin: 20px 0; }
.form-done .ref { font-size: 1.25rem; font-weight: 700; letter-spacing: 0.03em; }

/* Header line offering free language help in Spanish */
.lang-help { margin: 2px 0 6px; font-size: 0.8rem; }
/* Short privacy line above each online form's Send button */
.form-privacy { font-size: 0.85rem; color: #444; }

/* Phone PDF viewer: each page drawn by PDF.js, full width */
.doc-pages { width: 100%; }
.doc-page { display: block; width: 100%; height: auto; margin: 0 0 10px; border: 1px solid #ddd; background: #fff; }
