/* RPV — shared stylesheet. Mobile-first: base styles target a phone
   viewport; the one @media block near the bottom scales UP to desktop.
   Design system v2 (2026-09-24): Royal Park Village — a pine/sage
   palette grounded in the estate itself, IBM Plex Sans throughout for
   interface legibility, tabular numerals on financial figures. Every
   class name below is unchanged from v1 -- only the values inside
   them changed, so no page markup needed to change for this pass. */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600;700&display=swap');

:root {
  --color-bg: #ffffff;
  --color-bg-alt: #F7F8F5;
  --color-text: #24291F;
  --color-text-muted: #6B7565;
  --color-border: #DCE3D8;
  --color-primary: #2C5F4A;
  --color-primary-dark: #204436;
  --color-success-bg: #E4F1EF;
  --color-success-text: #1D6E6E;
  --color-error-bg: #F7E9E9;
  --color-error-text: #A33B3B;
  --color-warn-bg: #FBF0E1;
  --color-warn-border: #B8792E;
  --radius: 6px;
  --font: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--color-bg-alt);
  color: var(--color-text);
  line-height: 1.55;
  font-size: 15px;
}

a { color: var(--color-primary); }
a:hover { color: var(--color-primary-dark); }

/* ---- Header / nav ---- */
.site-header {
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
}
.brand { font-weight: 700; font-size: 19px; color: var(--color-primary); text-decoration: none; letter-spacing: -0.01em; }
.nav-toggle {
  background: none;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 18px;
  padding: 4px 12px;
  cursor: pointer;
  color: var(--color-text);
}
.site-nav { display: none; flex-direction: column; padding: 0 16px 16px; gap: 14px; }
.site-nav.open { display: flex; }
.nav-group { display: flex; flex-direction: column; }
.nav-group-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-muted);
  margin-bottom: 4px;
}
.nav-group a { padding: 9px 10px; color: var(--color-text); text-decoration: none; border-radius: var(--radius); font-size: 14px; }
.nav-group a.active { background: var(--color-primary); color: #fff; }
.nav-group a:hover:not(.active) { background: var(--color-bg-alt); }
.user-bar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 16px; font-size: 13px; color: var(--color-text-muted);
  border-top: 1px solid var(--color-border);
}
.user-bar a { text-decoration: none; }

.site-footer {
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px;
  padding: 16px; margin-top: 32px;
  border-top: 1px solid var(--color-border);
  font-size: 12px; color: var(--color-text-muted);
}

/* ---- Page frame ---- */
.page-content { max-width: 1100px; margin: 0 auto; padding: 20px 16px 60px; }
h1 { font-size: 22px; font-weight: 600; margin: 0 0 18px; letter-spacing: -0.01em; }
h2 { font-size: 16px; font-weight: 600; margin: 32px 0 10px; padding-top: 20px; border-top: 1px solid var(--color-border); }
h2:first-of-type { border-top: none; padding-top: 0; }
h3 { font-size: 14px; font-weight: 600; margin: 20px 0 8px; color: var(--color-text); }

/* ---- Messages ---- */
.msg { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px; font-size: 14px; }
.msg-success { background: var(--color-success-bg); color: var(--color-success-text); }
.msg-error { background: var(--color-error-bg); color: var(--color-error-text); }
.nextstep {
  background: var(--color-warn-bg);
  border: 1px solid var(--color-warn-border);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 16px;
}
.nextstep div { margin-top: 4px; }
.nextstep code { background: #fff; padding: 2px 6px; border-radius: 4px; font-weight: 600; }

/* ---- Tables ---- */
.table-wrap { overflow-x: auto; margin: 8px 0 16px; border-radius: var(--radius); border: 1px solid var(--color-border); }
table { width: 100%; border-collapse: collapse; background: var(--color-bg); font-size: 14px; }
th, td { padding: 7px 12px; border-bottom: 1px solid var(--color-border); text-align: left; white-space: nowrap; }
th { background: var(--color-bg-alt); font-weight: 600; color: var(--color-text-muted); font-size: 12px; }
td:not(:first-child), th:not(:first-child) { text-align: right; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--color-bg-alt); }
/* Buttons/links sitting alone inside a table cell don't need the
   form-field spacing (margin-top, larger padding) meant for a submit
   button below a stack of inputs -- that was inflating every row. */
td .btn, td button { margin: 0; padding: 5px 12px; font-size: 13px; }
/* Financial/numeric columns: tabular figures for real column alignment,
   not decoration -- a genuine accounting-software convention. */
td { font-variant-numeric: tabular-nums; }

/* ---- Forms ---- */
form.card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin: 8px 0;
}
form.card label { display: block; font-size: 13px; color: var(--color-text-muted); margin-bottom: 3px; margin-top: 8px; font-weight: 500; }
form.card label:first-child { margin-top: 0; }
form.card input:not([type="checkbox"]):not([type="radio"]), form.card select, form.card textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 15px;
  font-family: inherit;
  background: var(--color-bg);
  color: var(--color-text);
}
form.card input:focus, form.card select:focus, form.card textarea:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: -1px;
}
form.card .field-row { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
form.card .field-row label { margin: 0; }
form.card small { color: var(--color-text-muted); font-size: 12px; }

button, .btn { background: var(--color-primary); color: #fff; border: none; border-radius: var(--radius); padding: 9px 16px; font-size: 14px; font-weight: 600; cursor: pointer; margin-top: 10px; }
.btn { display: inline-block; text-decoration: none; margin-right: 8px; }
button:hover, .btn:hover { background: var(--color-primary-dark); }
button:disabled { background: var(--color-border); color: var(--color-text-muted); cursor: not-allowed; }
:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }

/* ---- Status colors (high contrast, used throughout) ---- */
.ok, .status-Paid, .locked, .pass, .reqyes, .badge-match { color: var(--color-success-text); font-weight: 600; }
.warn, .status-Open, .notlocked, .fail, .badge-mismatch, .override { color: var(--color-error-text); font-weight: 600; }
.muted, .reqno, .badge-none { color: var(--color-text-muted); }
.step { color: var(--color-text-muted); font-size: 11px; font-weight: 600; }

/* ---- Summary cards (dashboard-style number blocks) ---- */
.stat-grid { display: grid; grid-template-columns: 1fr; gap: 10px; margin: 12px 0 20px; }
.stat-card { background: var(--color-bg); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 14px 16px; }
.stat-card .stat-label { font-size: 12px; color: var(--color-text-muted); font-weight: 500; }
.stat-card .stat-value { font-size: 23px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }

/* ---- Disclosure: "buttons reveal forms" -- native <details>/<summary>,
   no JavaScript. A form/section stays collapsed until its own action
   is opened; only the currently-relevant one shows input fields. ---- */
details.reveal { margin: 10px 0; }
details.reveal > summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 11px 18px;
  font-size: 14px;
  font-weight: 600;
  margin-right: 8px;
  margin-top: 14px;
}
details.reveal > summary::-webkit-details-marker { display: none; }
details.reveal > summary:hover { background: var(--color-primary-dark); }
details.reveal[open] > summary { background: var(--color-text-muted); }
details.reveal[open] > summary:hover { background: var(--color-text); }
details.reveal .card-inner { margin-top: 4px; }

/* Secondary sections: a quieter top-border treatment instead of a
   bordered card, for content that's supporting rather than primary
   (deliberately varied from .stat-card/.table-wrap so not everything
   reads as an identical rounded box). */
.section-quiet { border-top: 1px solid var(--color-border); padding-top: 14px; margin-top: 14px; }

/* ---- Desktop ---- */
@media (min-width: 900px) {
  .header-bar { padding: 12px 24px; }
  .nav-toggle { display: none; }
  .site-nav { display: flex !important; flex-direction: row; flex-wrap: wrap; padding: 0 24px 12px; gap: 22px; }
  .nav-group { flex-direction: row; align-items: center; gap: 6px; }
  .nav-group-label { display: none; }
  .user-bar { padding: 10px 24px; }
  .page-content { padding: 28px 24px 80px; }
  form.card { max-width: 640px; }
  .stat-grid { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
}

/* ---- Info popups (House Hub summary) ----
   The line shows a short value; the detail behind it opens on hover
   (desktop) or tap (mobile -- tapping gives the element focus). Pure
   CSS, no JavaScript. Tapping elsewhere closes it again. */
.info-wrap { position: relative; display: inline-block; cursor: pointer; border-bottom: 1px dotted var(--color-text-muted); outline: none; }
.info-wrap:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }
.info-panel { display: none; position: absolute; right: 0; top: calc(100% + 4px); z-index: 50; min-width: 260px; max-width: min(420px, 85vw); background: var(--color-bg); border: 1px solid var(--color-border); border-radius: var(--radius); box-shadow: 0 6px 18px rgba(0,0,0,.14); padding: 8px 12px; text-align: left; white-space: normal; font-size: 13px; line-height: 1.45; cursor: default; }
.info-wrap:hover .info-panel, .info-wrap:focus-within .info-panel { display: block; }
.info-panel .info-item { padding: 6px 0; border-bottom: 1px solid var(--color-border); }
.info-panel .info-item:last-child { border-bottom: none; }
.info-panel .info-sub { padding-top: 6px; font-size: 12px; }
.summary-table td { white-space: normal; }
.summary-table td:first-child { white-space: nowrap; color: var(--color-text-muted); }

/* Money direction: red = the house owes the village, green = the village owes the house. */
.amt-owe { color: #b42318; font-weight: 600; font-variant-numeric: tabular-nums; }
.amt-credit { color: #1a7f37; font-weight: 600; font-variant-numeric: tabular-nums; }

/* Affected-house checklist (Create a Job): compact grid of house numbers. */
.house-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); gap: 2px 6px; max-height: 260px; overflow-y: auto; border: 1px solid var(--color-border); border-radius: var(--radius); padding: 8px; margin-top: 6px; }
.house-grid label { display: flex !important; align-items: center; gap: 4px; margin: 0 !important; font-size: 13px; color: var(--color-text) !important; font-weight: 400 !important; cursor: pointer; }

/* Annual Cycle steps */
.cycle-step { padding: 12px 16px; margin: 8px 0; max-width: 820px; }
.cycle-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-weight: 600; }
.price-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px 12px; margin-top: 8px; }
.price-form label { display: flex; flex-direction: column; font-size: 13px; color: var(--color-text-muted); gap: 3px; }
.price-form input { padding: 7px 9px; border: 1px solid var(--color-border); border-radius: var(--radius); font-size: 15px; }
.price-form button { grid-column: 1 / -1; justify-self: start; }

/* Where-you-are trail + back link (every page) */
.crumbs { font-size: 13px; color: var(--color-text-muted); margin: 0 0 6px; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.crumbs a { color: var(--color-text-muted); }
.crumbs .crumb-back { font-weight: 600; color: var(--color-primary); margin-right: 8px; }
.crumbs .crumb-sep { opacity: 0.6; }
.refused-why { font-size: 13px; color: var(--color-text-muted); margin: 4px 0 0; }

/* Reports */
.report-tabs { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0 10px; }
.report-tabs a { padding: 6px 12px; border: 1px solid var(--color-border); border-radius: var(--radius); font-size: 14px; text-decoration: none; }
.report-tabs a.active { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }
.report-filter { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 10px; }
.report-filter label { display: flex; flex-direction: column; font-size: 13px; color: var(--color-text-muted); margin: 0; }
td.num, th.num { text-align: right; white-space: nowrap; }
table.statement th { text-align: left; background: transparent; }
tr.subtotal td { border-top: 1px solid var(--color-border); font-weight: 600; }
.report-columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
@media print {
  .site-header, .crumbs, .no-print, .site-footer, .report-tabs, .nav-toggle { display: none !important; }
  .page-content { max-width: none; padding: 0; }
  details { display: block; } details > summary { display: none; } details > * { display: block; }
}

/* "Write this number on the receipt" */
.doc-callout { border: 2px solid var(--color-primary); font-size: 17px; padding: 12px 16px; margin: 8px 0 14px; }
.doc-callout strong { font-size: 22px; letter-spacing: 0.03em; margin: 0 4px; }

/* Button tiles: landing pages (one focused action per screen) */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; margin: 8px 0; }
.tile { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border: 1px solid var(--color-border); border-radius: var(--radius); background: var(--color-surface, #fff); text-decoration: none; color: inherit; }
.tile:hover { border-color: var(--color-primary); }
.tile-label { font-weight: 700; font-size: 16px; color: var(--color-primary); }
.tile-sub { font-size: 13px; color: var(--color-text-muted); }
.tile-alert { border-color: #c0392b; } .tile-alert .tile-sub { color: #c0392b; font-weight: 600; }

/* Task buttons replacing inline forms: the form opens on its own screen */
.task-btn { display: inline-block; margin: 4px 6px 4px 0; padding: 8px 14px; border: 1px solid var(--color-primary); border-radius: var(--radius); color: var(--color-primary); font-weight: 600; text-decoration: none; font-size: 14px; }
.task-btn:hover { background: var(--color-primary); color: #fff; }
.task-btn span { font-weight: 400; opacity: 0.8; }

/* 7-item main menu (0176): links sit directly in the nav */
.site-nav > a { padding: 9px 12px; color: var(--color-text); text-decoration: none; border-radius: var(--radius); font-size: 15px; }
.site-nav > a.active { background: var(--color-primary); color: #fff; }
.site-nav > a:hover:not(.active) { background: var(--color-bg-alt); }
@media (min-width: 900px) { .site-nav { gap: 6px; align-items: center; } }
