/* ==========================================================================
   Green Hive Plus - Society Digital Platform
   Theme colours derived from the society logo:
   - Deep leaf green   : #2E6B3E
   - Hive blue         : #1D6FA8
   - Olive / lime green: #8CB93C
   - Navy (plus mark)  : #34386B
   - Warm amber (pending): #C8862B
   ========================================================================== */

/* Plus Jakarta Sans (SIL Open Font License, see assets/fonts/OFL.txt): open, clear letters
   that stay easy to read at small sizes and late at night. Latin subset, one variable file. */
@font-face{
  font-family: "Plus Jakarta Sans";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("../assets/fonts/plus-jakarta-sans.woff2") format("woff2");
}

:root{
  --green-deep:   #2E6B3E;
  --green-mid:    #4E8B4E;
  --lime:         #8CB93C;
  --blue:         #1D6FA8;
  --blue-dark:    #155A8A;
  --navy:         #34386B;
  --amber:        #C8862B;
  --red:          #B3452C;

  --bg:           #F5F8F4;
  --surface:      #FFFFFF;
  --surface-alt:  #EEF3EB;
  --border:       #DDE5D8;
  --border-strong: #C2CEBD;
  --text:         #23302A;
  --text-muted:   #5B6B62;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(35,48,42,0.08);
  --shadow-md: 0 6px 20px rgba(35,48,42,0.10);

  /* Text-safe variants of the brand colours (they change in dark mode;
     the plain brand colours above stay as fills with white text on them) */
  --green-text:   #2E6B3E;
  --blue-text:    #155A8A;
  --navy-text:    #34386B;

  /* Soft tints for badges, chips and hover states */
  --tint-green:        #E6F0E3;
  --tint-green-strong: #E4F2E2;
  --tint-blue:         #E1ECF7;
  --tint-amber:        #FBEBD8;
  --tint-red:          #FBEDEA;
  --tint-violet:       #ECE8F8;
  --amber-text:        #86560F;
  --red-text:          #9C3A24;
  --violet-text:       #4B3F8F;
  --border-blue:       #C9DEF0;
  --hover-row:         #FAFCF9;
  --primary-hover:     #275A34;
  --gate-bg: linear-gradient(160deg, #EAF1E6 0%, #DCEAE2 45%, #E4EEF6 100%);
  --header-bg: rgba(255,255,255,0.86);

  /* Portal sidebar (deep green to blue, same family as the home page hero) */
  --side-bg: linear-gradient(185deg, #0F2D20 0%, #14402D 55%, #123A57 100%);
  --side-text: #E6F0EA;
  --side-muted: rgba(230,240,234,0.62);
  --side-hover: rgba(255,255,255,0.08);
  --side-active: rgba(255,255,255,0.14);
  --side-border: rgba(255,255,255,0.12);

  --font: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Devanagari", Helvetica, Arial, sans-serif;
}

/* Dark theme. theme.js sets data-theme="dark" on <html> for "Dark", or for
   "System" when the device prefers dark. */
:root[data-theme="dark"]{
  color-scheme: dark;
  --bg:           #0E1218;
  --surface:      #161B23;
  --surface-alt:  #1D2430;
  --border:       #2B3340;
  --border-strong: #3E495A;
  --text:         #E9EDF2;
  --text-muted:   #9BA7B6;

  --green-deep:   #2F8050;
  --green-mid:    #4E9E62;
  --blue:         #2F86C4;
  --blue-dark:    #2477B3;
  --navy:         #4B50A3;
  --amber:        #E0A04A;
  --red:          #EC8A74;

  --green-text:   #86D9A0;
  --blue-text:    #8CC4F0;
  --navy-text:    #C7CAF5;

  --tint-green:        #1C3027;
  --tint-green-strong: #1E3629;
  --tint-blue:         #172C3F;
  --tint-amber:        #3A2C16;
  --tint-red:          #3B1F1A;
  --tint-violet:       #262040;
  --amber-text:        #E0A04A;
  --red-text:          #EC8A74;
  --violet-text:       #B9ACF0;
  --border-blue:       #284A66;
  --hover-row:         #1A212B;
  --primary-hover:     #3A9560;
  --gate-bg: linear-gradient(160deg, #0C1015 0%, #112028 45%, #0E1A27 100%);
  --header-bg: rgba(22,27,35,0.86);
  --side-bg: linear-gradient(185deg, #0B1117 0%, #0F1D27 55%, #0E2338 100%);

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.35);
  --shadow-md: 0 8px 24px rgba(0,0,0,0.45);
}
:root[data-theme="dark"] .ev-spot{ background: linear-gradient(135deg, #14312F 0%, #1B4A45 45%, #1D5A8C 100%); }


/* The logo image has a white background, so it keeps a white tile in dark mode */
:root[data-theme="dark"] .gate-logo,
:root[data-theme="dark"] .sidebar-logo,
:root[data-theme="dark"] .site-brand-logo{ background: #fff; border-radius: 10px; padding: 3px; }

*, *::before, *::after{ box-sizing: border-box; }

[hidden]{ display: none !important; }

html, body{
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body{
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

.sr-only{
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
}

button{ font-family: inherit; cursor: pointer; }
input, select{ font-family: inherit; }

/* ---------- Buttons ---------- */
.btn{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  transition: background .15s ease, border-color .15s ease, transform .05s ease;
  white-space: nowrap;
}
.btn:active{ transform: translateY(1px); }

.btn-primary{
  background: linear-gradient(135deg, var(--green-deep), var(--green-mid));
  color: #fff;
  box-shadow: 0 3px 10px rgba(46,107,62,0.22);
}
.btn-primary:hover{ background: linear-gradient(135deg, var(--primary-hover), var(--green-deep)); }
/* Dark theme: a slightly deeper green so the white label stays easy to read */
:root[data-theme="dark"] .btn-primary{ background: linear-gradient(135deg, #276C44, #34794D); }
:root[data-theme="dark"] .btn-primary:hover{ background: linear-gradient(135deg, #2E7448, #368152); }

.btn-secondary{
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}
.btn-secondary:hover{ background: var(--surface-alt); }

.btn-ghost{
  background: transparent;
  color: var(--text);
  border-color: transparent;
}
.btn-ghost:hover{ background: var(--surface-alt); }

.btn-danger{
  background: #fff;
  color: var(--red);
  border-color: #e6c3ba;
}
.btn-danger:hover{ background: var(--tint-red); }

.btn-block{ width: 100%; }

/* ==========================================================================
   Access Gate
   ========================================================================== */
.gate{
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  /* Not "center": when the card is taller than the screen (a phone, or a browser with its address bar showing) centring pushes the top
     out of reach and the logo and title get cropped. The card centres itself with margin auto, and the page scrolls from the top. */
  justify-content: flex-start;
  background: var(--gate-bg);
  /* No padding at the top or the sides: the strip across the top (Home, theme) and the footer run edge to edge by themselves, with no tricks
     that a browser could drop. The card keeps its own margin. */
  padding: 0 0 20px;
  padding-bottom: max(20px, env(safe-area-inset-bottom));
  z-index: 100;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.gate .gate-card{ margin: auto; width: calc(100% - 40px); max-width: 380px; }
/* The footer keeps a gap above it that follows the visible height of the screen (the card above centres itself in the space that is left, and
   never touches the footer line, whatever the screen or the browser's address bar). The first value is the fallback for an old browser. */
.gate-footer{ align-self: stretch; margin-top: 32px; margin-top: clamp(24px, 6dvh, 56px); flex-shrink: 0; padding-bottom: 12px; }

.gate-card{
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 36px 32px 28px;
  max-width: 380px;
  width: 100%;
  text-align: center;
}

.gate-logo{
  width: 120px;
  height: auto;
  margin: 0 auto 18px;
  display: block;
}

.gate-title{
  margin: 0 0 6px;
  font-size: 20px;
  color: var(--navy-text);
}

.gate-sub{
  margin: 0 0 20px;
  font-size: 13.5px;
  color: var(--text-muted);
}

.gate-input-wrap{
  position: relative;
  margin-bottom: 12px;
}

#gateForm input, .gate-form input, .gate-form select{
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  background: var(--bg);
  color: var(--text);
}
.gate-input-wrap input{
  margin-bottom: 0;
  padding-right: 42px;
}
#gateForm input:focus, .gate-form input:focus, .gate-form select:focus{
  outline: none;
  border-color: var(--green-mid);
  box-shadow: 0 0 0 3px rgba(78,139,78,0.18);
}

.gate-toggle-visibility{
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  padding: 7px;
  border-radius: 6px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
}
.gate-toggle-visibility:hover{ background: var(--surface-alt); color: var(--text); }
.gate-toggle-visibility .icon{ width: 19px; height: 19px; }
.gate-toggle-visibility .icon-eye-off{ display: none; }
.gate-toggle-visibility.is-showing .icon-eye{ display: none; }
.gate-toggle-visibility.is-showing .icon-eye-off{ display: block; }

.gate-error{
  color: var(--red);
  font-size: 13px;
  margin-top: 10px;
}

.gate-footnote{
  margin: 18px 0 0;
  font-size: 12px;
  color: var(--text-muted);
}

.gate-hint{
  color: var(--blue-text);
  font-size: 12.5px;
  margin-top: 10px;
}

.gate-link-btn{
  display: block;
  margin: 14px auto 0;
  background: transparent;
  border: none;
  color: var(--blue-text);
  font-size: 13px;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.gate-link-btn:hover{ color: var(--blue-text); }

.gate-revealed-code{
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: .02em;
  background: var(--surface-alt);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin: 10px 0 16px;
  color: var(--navy-text);
  word-break: break-all;
}

/* ==========================================================================
   App shell - sidebar + topbar layout
   ========================================================================== */
.icon{ width: 18px; height: 18px; flex-shrink: 0; }
.icon-btn{
  background: transparent;
  border: none;
  padding: 8px;
  border-radius: var(--radius-sm);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.icon-btn:hover{ background: var(--surface-alt); }
.icon-btn .icon{ width: 22px; height: 22px; }

.shell{
  min-height: 100vh;
  display: flex;
}

/* ---------- Sidebar (committee portal navigation) ---------- */
.sidebar{
  width: 280px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--side-bg);
  color: var(--side-text);
  position: fixed;
  top: 0; bottom: 0; left: 0;
  z-index: 60;
  transform: translateX(-100%);
  transition: transform .2s ease;
}
.sidebar.sidebar-open{ transform: translateX(0); box-shadow: var(--shadow-md); }
:root[data-theme="dark"] .sidebar{ border-right: 1px solid var(--border); }

@media (min-width: 960px){
  .sidebar{ position: sticky; transform: none; height: 100vh; }
}

.sidebar-brand{
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 18px 18px;
  border-bottom: 1px solid var(--side-border);
  text-decoration: none;
  color: inherit;
  transition: background .15s ease;
}
.sidebar-brand:hover{ background: var(--side-hover); }
.sidebar-logo{
  width: 42px;
  height: 42px;
  padding: 4px;
  object-fit: contain;
  flex-shrink: 0;
  background: #fff;
  border-radius: 12px;
}
.sidebar-brand-text{ display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.brand-name{ font-weight: 700; font-size: 15px; color: var(--navy-text); }
.brand-tag{ font-size: 12px; color: var(--text-muted); }
.sidebar .brand-name{ color: #fff; font-size: 15.5px; }
.sidebar .brand-tag{ color: var(--side-muted); font-size: 12px; }

.sidebar-nav{
  flex: 1;
  overflow-y: auto;
  padding: 6px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nav-group-label{
  padding: 16px 12px 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--side-muted);
}

.nav-item{
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  text-align: left;
  background: transparent;
  border: none;
  border-radius: 12px;
  font-size: 14.5px;
  font-weight: 500;
  color: var(--side-text);
  transition: background .15s ease;
}
.nav-item:hover{ background: var(--side-hover); }
.nav-item .icon{ width: 20px; height: 20px; color: var(--side-muted); transition: color .15s ease; }
.nav-item:hover .icon{ color: var(--side-text); }
.nav-item-label{ flex: 1; min-width: 0; line-height: 1.25; }
.nav-item:focus-visible{ outline-color: var(--lime); outline-offset: -2px; }

.nav-item-active{ background: var(--side-active); color: #fff; font-weight: 600; }
.nav-item-active .icon, .nav-item-active:hover .icon{ color: var(--lime); }
.nav-item-active::before{
  content: "";
  position: absolute;
  left: -12px;
  top: 9px;
  bottom: 9px;
  width: 4px;
  border-radius: 0 4px 4px 0;
  background: var(--lime);
}

.nav-item-disabled{ cursor: default; color: var(--side-muted); }
.nav-item-disabled:hover{ background: transparent; }
.nav-item-disabled:hover .icon{ color: var(--side-muted); }
.nav-item-badge{
  flex-shrink: 0;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255,255,255,0.12);
  color: var(--side-text);
  font-size: 12px;
  font-weight: 600;
}

.sidebar-footer{
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 12px 16px;
  border-top: 1px solid var(--side-border);
}
.sidebar .btn-ghost{
  justify-content: flex-start;
  gap: 10px;
  padding: 11px 14px;
  border: 1px solid var(--side-border);
  border-radius: 12px;
  background: transparent;
  color: var(--side-text);
  font-weight: 600;
  text-decoration: none;
}
.sidebar .btn-ghost:hover{ background: var(--side-hover); }
.sidebar .btn-ghost:focus-visible{ outline-color: var(--lime); }

.sidebar-overlay{
  position: fixed;
  inset: 0;
  background: rgba(24,32,28,0.45);
  z-index: 55;
}
@media (min-width: 960px){
  .sidebar-overlay{ display: none !important; }
}

/* ---------- Main column ---------- */
.shell-main{
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar{
  background: var(--header-bg);
  -webkit-backdrop-filter: saturate(160%) blur(10px);
  backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 68px;
  padding: 12px 16px;
}
@media (min-width: 640px){
  .topbar{ padding: 12px 28px; }
}
.sidebar-toggle{ }
@media (min-width: 960px){
  .sidebar-toggle{ display: none; }
}

.topbar-title{ flex: 1; min-width: 0; }
.topbar-title h1{ margin: 0; font-size: 19px; letter-spacing: -0.2px; color: var(--navy-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 559px){
  .topbar{ gap: 8px; }
  .topbar-title h1{ font-size: 17px; }
  .topbar-actions{ gap: 8px; }
}
.topbar-subtitle{
  margin: 1px 0 0;
  font-size: 12px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-actions{ display: flex; align-items: center; gap: 12px; align-self: flex-start; }
.last-updated{ font-size: 12px; line-height: 26px; color: var(--text-muted); display: none; }

@media (min-width: 640px){
  .last-updated{ display: inline; }
}

.content{
  flex: 1;
  max-width: 1180px;
  margin: 0 auto;
  padding: 20px;
  width: 100%;
  outline: none;
}

.footer{
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  padding: 18px 20px 26px;
}

.footer-credit{ margin-top: 6px; }

.footer-link-btn{
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  color: var(--blue-text);
  font-size: inherit;
  font-family: inherit;
  text-decoration: underline;
  cursor: pointer;
}
.footer-link-btn:hover{ color: var(--navy-text); }

.legal-content h3{
  font-size: 13.5px;
  margin: 16px 0 4px;
  color: var(--navy-text);
}
.legal-content h3:first-child{ margin-top: 0; }
.legal-content p{
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
  margin: 0 0 4px;
}
.legal-content ul{ margin: 4px 0 6px; padding-left: 20px; font-size: 13px; line-height: 1.5; color: var(--text); }
.legal-content li{ margin-bottom: 3px; }
.legal-content p + p{ margin-top: 6px; }
.legal-content a{ color: var(--blue-text); text-decoration: underline; }
.legal-content a:hover{ color: var(--navy-text); }

/* Sits above both the buildings grid and a building's own registry, so
   connecting a data source and adding an entry are always reachable. */
.module-actions-bar{ margin-bottom: 18px; }

/* ---------- Buildings landing grid ---------- */
.buildings-header{ margin-bottom: 16px; }
.buildings-header h2{ margin: 0 0 4px; font-size: 19px; color: var(--navy-text); }
.buildings-sub{ margin: 0; font-size: 13.5px; color: var(--text-muted); }

/* As many columns as fit (never wider than the space next to the sidebar), at least two on a phone. */
.buildings-grid{
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}
.buildings-grid > *{ min-width: 0; }
@media (max-width: 359px){
  .buildings-grid{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.building-card{
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  gap: 6px;
  min-height: 92px;
  padding: 16px 48px 16px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  text-align: left;
  cursor: pointer;
  transition: box-shadow .15s ease, transform .15s ease, border-color .15s ease;
}
/* The round arrow badge is what says "this opens something" */
.building-card::after{
  content: "\203A";
  position: absolute;
  top: 14px;
  right: 14px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--tint-green);
  color: var(--green-text);
  font-size: 20px;
  line-height: 27px;
  text-align: center;
  transition: background .15s ease, color .15s ease, transform .15s ease;
}
.building-card:hover, .building-card:focus-visible{
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  border-color: var(--green-mid);
}
.building-card:hover::after, .building-card:focus-visible::after{
  background: var(--green-deep);
  color: #fff;
  transform: translateX(2px);
}
.building-card:active{ transform: translateY(0); box-shadow: var(--shadow-sm); }
.building-card-name{ font-size: 19px; font-weight: 700; color: var(--navy-text); }
.building-card-stat{ font-size: 12px; color: var(--text-muted); font-weight: 600; }

.building-card-inactive{
  cursor: default;
  background: transparent;
  border-style: dashed;
  box-shadow: none;
}
.building-card-inactive::after{ display: none; }
.building-card-inactive:hover, .building-card-inactive:focus-visible{
  box-shadow: none;
  transform: none;
  border-color: var(--border);
}
.building-card-inactive .building-card-name{ color: var(--text-muted); }

/* ---------- Per-building registry view ---------- */
.back-to-buildings-btn{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px 8px 8px;
  margin-bottom: 10px;
  border: none;
  background: transparent;
  color: var(--green-text);
  font-size: 13.5px;
  font-weight: 600;
  border-radius: var(--radius-sm);
}
.back-to-buildings-btn:hover{ background: var(--surface-alt); }
.back-to-buildings-btn .icon{ width: 16px; height: 16px; }

.registry-building-title{ margin: 0 0 14px; font-size: 20px; color: var(--navy-text); }

/* ---------- Summary cards ---------- */
.summary{
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}
@media (min-width: 720px){
  /* auto-fit rather than a hardcoded column count so this row keeps
     wrapping neatly as more stat cards get added later, instead of the
     layout needing rework each time. */
  .summary{ grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
}

.summary-card{
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  border-left: 4px solid var(--green-mid);
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: box-shadow .15s ease, transform .15s ease;
}

.summary-label{ font-size: 12px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .02em; }
.summary-value{ font-size: 26px; font-weight: 700; color: var(--text); }

.cat-2w{ border-left-color: var(--blue); }
.cat-3w{ border-left-color: var(--lime); }
.cat-4w{ border-left-color: var(--green-deep); }
.cat-total{ border-left-color: var(--navy); }
.cat-pending{ border-left-color: var(--amber); }
.cat-pending .summary-value{ color: var(--amber); }
.cat-owner{ border-left-color: var(--green-mid); }
.cat-tenant{ border-left-color: var(--blue-dark); }

/* ---------- Toolbar ---------- */
.toolbar{
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
}

.toolbar-row{ display: flex; gap: 8px; flex-wrap: wrap; }

.toolbar-search{ align-items: center; }
.search-wrap{ position: relative; flex: 1 1 auto; min-width: 0; }
.search-icon{
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  pointer-events: none;
}
.toolbar-search input[type="search"]{
  width: 100%;
  padding-left: 36px;
}

/* "Filters" toggle - only meaningful on mobile, where the filter row
   collapses behind it; hidden on desktop where the row is always shown. */
.filter-toggle-btn{
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  flex-shrink: 0;
}
.filter-toggle-btn .icon{ width: 16px; height: 16px; }
.filter-toggle-btn.is-open{ border-color: var(--green-mid); color: var(--green-text); }
.filter-count-badge{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--green-mid);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

.toolbar-filters{
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.toolbar-filters select{ flex: 1 1 150px; min-width: 0; }

.toolbar input, .toolbar select{
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 14px;
  color: var(--text);
}
.toolbar input:focus, .toolbar select:focus{
  outline: none;
  border-color: var(--green-mid);
  box-shadow: 0 0 0 3px rgba(78,139,78,0.15);
}

.toolbar-actions{ justify-content: space-between; }
.toolbar-actions > .menu-wrap{ margin-left: auto; }

/* Active-filter chips + result count, between the filter row and the
   action buttons - each chip removes just that one filter, and "Clear
   all" appears once 2+ filters are stacked together. */
.toolbar-status-row{ justify-content: space-between; align-items: center; }
.active-filter-chips{ display: flex; gap: 6px; flex-wrap: wrap; }
.filter-chip{
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 6px 4px 10px;
  border-radius: 999px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}
.filter-chip-remove{
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1;
}
.filter-chip-remove:hover{ background: var(--border); color: var(--text); }
.filter-chip-clear-all{
  padding: 4px 10px;
  background: transparent;
  border: 1px dashed var(--border);
  color: var(--text-muted);
  cursor: pointer;
}
.filter-chip-clear-all:hover{ color: var(--red); border-color: var(--red); }
.result-count{ font-size: 12.5px; color: var(--text-muted); white-space: nowrap; }

/* Mobile toolbar: search on its own full-width row (with the Filters
   toggle alongside it), filters as a tidy two-column grid collapsed
   behind that toggle so four dropdowns don't wrap raggedly one-per-line
   and eat space before you've even searched, and the action buttons
   stack full-width for easy tapping. */
@media (max-width: 639px){
  .toolbar-filters{
    display: none;
    grid-template-columns: 1fr 1fr;
  }
  .toolbar-filters.is-open{ display: grid; }
  .toolbar-filters select{ width: 100%; }
  .toolbar-actions{ flex-direction: column; align-items: stretch; }
  .toolbar-actions > .btn{ width: 100%; }
  .toolbar-actions .menu-wrap{ width: 100%; }
  .toolbar-actions .menu-wrap > .btn{ width: 100%; }
  .menu{ left: 0; right: 0; min-width: 0; width: 100%; }
  .toolbar-status-row{ flex-direction: column; align-items: flex-start; gap: 6px; }
}

@media (min-width: 640px){
  .filter-toggle-btn{ display: none; }
}

.menu-wrap{ position: relative; }
.menu{
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  min-width: 240px;
  padding: 6px;
  z-index: 30;
}
.menu-item{
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 14px;
  color: var(--text);
}
.menu-item:hover{ background: var(--surface-alt); }
.menu-divider{ height: 1px; background: var(--border); margin: 6px 4px; }

/* ---------- Sheet sync status + modal ---------- */
.sheet-status{
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: var(--text-muted);
  margin: 2px 0 0;
}
.sheet-dot{
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--green-mid);
  flex: none;
}
.sheet-dot-error{ background: var(--red); }
.sheet-status-error{ color: var(--red); }
.sheet-steps{
  font-size: 13px;
  color: var(--text-muted);
  padding-left: 18px;
  margin: 0 0 14px;
}
.sheet-steps li{ margin-bottom: 6px; }
.sheet-steps strong{ color: var(--text); }

.sheet-writeback-section{
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 8px);
  padding: 10px 12px;
  margin: 4px 0 14px;
  background: var(--surface-alt);
}
.sheet-writeback-section summary{
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--navy-text);
}
.sheet-writeback-section summary::marker{ color: var(--text-muted); }
.sheet-writeback-section .import-summary{ margin: 10px 0; }
.sheet-writeback-section .form-field{ margin-bottom: 10px; }
.sheet-writeback-section .form-field:last-child{ margin-bottom: 0; }

.source-pill{
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.source-sheet{ background: var(--tint-blue); color: var(--blue-text); }
.source-local{ background: var(--surface-alt); color: var(--text-muted); }

/* ---------- Registry table ---------- */
.registry{ background: var(--surface); border-radius: var(--radius-md); box-shadow: var(--shadow-sm); overflow: hidden; }
/* position:relative keeps absolutely-positioned children (the visually
   hidden "Details" header label) inside this scroll box, instead of them
   escaping it and widening the whole page with a horizontal scrollbar. */
.table-wrap{ overflow-x: auto; position: relative; }

.registry-table{ width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 880px; }
.registry-table thead th{
  text-align: left;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: var(--text-muted);
  background: var(--surface-alt);
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.registry-table tbody td{
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.registry-table tbody tr:hover{ background: var(--hover-row); }
.registry-table tbody tr:last-child td{ border-bottom: none; }

.registry-row{ cursor: pointer; }
.registry-row:hover{ background: var(--hover-row); }
.registry-row:focus-visible{ outline: 2px solid var(--green-mid); outline-offset: -2px; }
.registry-row:active{ background: var(--surface-alt); }

.col-chevron{ width: 32px; text-align: right; padding-right: 14px !important; }
.chevron-icon{ width: 16px; height: 16px; color: var(--text-muted); }

.col-actions{ text-align: right; }

.badge{
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-issued{ background: var(--tint-green-strong); color: var(--green-text); }
.badge-pending{ background: var(--tint-amber); color: var(--amber-text); }

.cat-pill{
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: var(--surface-alt);
  color: var(--text);
  white-space: nowrap;
}

/* Vehicle numbers get typed in every format imaginable (full plate, spaced
   out, just the last 4 digits) - a bold monospace, highlighted pill makes
   the number the one thing that's always easy to spot in a row, no matter
   how it was entered. */
/* Groups the main vehicle-pill with its "+N" count pill (when there's more
   than one vehicle) as a single unit, so on mobile - where the row is a
   flex line spacing the label and value apart - the two pills always stay
   together on the value side instead of getting spaced apart from each
   other as if they were separate columns. */
.vehicle-pill-group{
  display: inline-flex;
  align-items: center;
  flex-wrap: nowrap;
}

.vehicle-pill{
  display: inline-block;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: .01em;
  background: var(--tint-blue);
  color: var(--blue-text);
  border: 1px solid var(--border-blue);
  white-space: nowrap;
}

.row-edit-btn{
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 12.5px;
  color: var(--blue-text);
}
.row-edit-btn:hover{ background: var(--surface-alt); }

.empty-state{
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}

/* ==========================================================================
   Mobile card layout for registry (below 720px, table becomes cards)
   ========================================================================== */
@media (max-width: 719px){
  .registry{ background: transparent; box-shadow: none; border-radius: 0; }
  .table-wrap{ overflow: visible; }
  .registry-table{ min-width: 0; border-collapse: separate; border-spacing: 0 10px; }
  .registry-table thead{
    position: absolute;
    width: 1px; height: 1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
  }
  .registry-table, .registry-table tbody{ display: block; width: 100%; }
  .registry-table tr{
    display: block;
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: 6px 14px;
    /* Rows are display:block on mobile, so the table's border-spacing
       (which only applies to actual table layout) has no effect - use a
       real margin instead so cards don't touch each other. */
    margin-bottom: 12px;
  }
  .registry-table tr:last-child{ margin-bottom: 0; }
  .registry-table td{
    display: flex;
    width: 100%;
    border: none;
    border-bottom: 1px solid var(--surface-alt);
    padding: 9px 0;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    text-align: right;
  }
  .registry-table tr td:last-child{ border-bottom: none; }
  .registry-table td::before{
    content: attr(data-label);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .02em;
    color: var(--text-muted);
    font-weight: 600;
    text-align: left;
    flex-shrink: 0;
  }

  /* Building + Flat are one identity line ("A13 - 106"), left-aligned like
     a heading rather than split space-between like the other fields. */
  .registry-table td[data-label="Unit"]{
    font-size: 16px;
    font-weight: 700;
    color: var(--navy-text);
    justify-content: flex-start;
    text-align: left;
  }
  .registry-table td[data-label="Unit"]::before{ display: none; }

  /* Vehicle number/count is usually the field being looked up at the gate -
     give it more visual weight than the rest of the card. */
  .registry-table td[data-label="Vehicles"]{ font-size: 15px; }

  .col-actions{ justify-content: flex-end !important; padding-top: 12px !important; }
  .col-actions::before{ display: none; }
  .col-actions .row-edit-btn{ width: 100%; text-align: center; padding: 10px; }

  /* Simplified summary row (Building/Flat/Vehicle/Resident/Status) -
     the chevron cell replaces the old full-width Actions button since
     the whole card is now tappable to open full details. */
  .registry-table tr.registry-row{
    position: relative;
    padding-right: 34px;
  }
  .registry-table td.col-chevron{
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: auto !important;
    display: block !important;
    padding: 0 !important;
    border: none !important;
  }
  .registry-table td.col-chevron::before{ display: none; }
  .registry-table td[data-label="Sticker"]{ border-bottom: none; padding-top: 2px; }
}

/* ==========================================================================
   Modals
   ========================================================================== */
/* Centered floating card on every screen size, phones included - rounded
   on all four corners, with breathing room around it rather than pinned
   edge-to-edge as a bottom sheet (which was clipping corners and reading
   as "half a card" on mobile). */
.modal-overlay{
  position: fixed;
  inset: 0;
  background: rgba(24,32,28,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 110;
  padding: 16px;
  padding-top: max(16px, env(safe-area-inset-top));
  padding-bottom: max(16px, env(safe-area-inset-bottom));
}

/* .modal is the rounded card frame itself: it clips its own corners
   (overflow: hidden) and never scrolls directly. The actual scrolling -
   and all the padding - happens on the .modal-scroll div nested just
   inside it. Scrolling the outer, rounded element directly was what made
   the browser's scrollbar poke out past the rounded corners (visible as a
   straight grey strip cutting across a curved edge); scrolling an inner,
   square-cornered child instead means the scrollbar itself has nothing to
   clip - it's simply inside the frame, which is exactly what clips it. */
.modal{
  background: var(--surface);
  width: 100%;
  max-width: 640px;
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  max-height: calc(var(--app-h, 100dvh) - 32px);
  overflow: hidden;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
}
/* Dark theme: a clearly darker backdrop and a lighter, outlined card, so a popup
   never blends into the page behind it. */
:root[data-theme="dark"] .modal-overlay{ background: rgba(2,5,9,0.78); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
:root[data-theme="dark"] .modal{
  background: #1F2733;
  border-color: #46536A;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.05), 0 24px 60px rgba(0,0,0,0.75);
}
.modal-scroll{
  overflow-y: auto;
  padding: 20px 20px 24px;
  /* Thin, theme-coloured scrollbar instead of the bulky default one. */
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
@media (min-width: 640px){
  .modal-scroll{ padding: 24px 28px 28px; }
}
.modal-scroll::-webkit-scrollbar{ width: 6px; }
.modal-scroll::-webkit-scrollbar-track{ background: transparent; }
.modal-scroll::-webkit-scrollbar-thumb{ background: var(--border); border-radius: 3px; }
.modal-sm{ max-width: 440px; }

/* Shared header bar for the Terms & Privacy and Committee Setup Guide popups: title on the left, actions and close on the right */
.modal-guide, .modal-legal{ max-width: 860px; height: min(92vh, 900px); }
.modal-bar{ display: flex; align-items: center; gap: 10px; padding: 12px 14px 12px 20px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.modal-bar h2{ margin: 0; margin-right: auto; font-size: 17px; color: var(--navy-text); min-width: 0; }
.modal-overlay[data-role="guide-modal"]{ z-index: 120; }
.guide-dl{ padding: 8px 14px; font-size: 14px; text-decoration: none; white-space: nowrap; }
.guide-dl .icon{ width: 16px; height: 16px; }
.guide-frame{ flex: 1; width: 100%; border: 0; background: var(--surface); min-height: 0; }
.guide-note{ margin: 0; padding: 24px 20px; font-size: 15px; line-height: 1.6; color: var(--text); }
.guide-note a{ color: var(--blue-text); font-weight: 600; }
@media (max-width: 559px){
  .modal-guide, .modal-legal{ height: calc(100vh - 24px); height: calc(100dvh - 24px); height: calc(var(--app-h, 100dvh) - 24px); }
  .modal-bar{ padding-left: 14px; gap: 6px; }
  .modal-bar h2{ font-size: 15px; }
  .guide-dl span{ display: none; }
  .guide-dl{ padding: 8px 10px; }
}

/* Terms & Privacy: reads as a wide "landscape" card on desktop (shorter,
   easier to skim, closer to a document page) and automatically narrows
   back down to a normal tall "portrait" card on phones simply because it
   can never exceed the (narrow) viewport width there - no separate mobile
   rule needed, the same max-width just stops applying. */
.legal-content{ max-width: 840px; margin: 0; }
.text-link-btn{ background: none; border: 0; padding: 0; font: inherit; color: var(--blue-text); text-decoration: underline; cursor: pointer; }
.text-link-btn:hover{ color: var(--navy-text); }

/* While any modal (or confirm dialog, which reuses .modal-overlay) is open,
   the page underneath is frozen - otherwise touch/wheel scrolling reaches
   past the dialog into the building/flat list behind it. Toggled globally
   by js/core/dom.js whenever a .modal-overlay is shown/hidden. */
/* position:fixed (not just overflow:hidden) so a touch-drag on a phone
   can't scroll the page underneath either - overflow:hidden alone is
   known to not block touch scrolling in some mobile browsers. `top` is
   set inline by js/core/dom.js to the scroll position at the moment the
   modal opened, so the page doesn't visually jump when this engages. */
body.modal-open{
  overflow: hidden;
  position: fixed;
  left: 0;
  right: 0;
  width: 100%;
}

.modal-head{
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.modal-head h2{ margin: 0; font-size: 18px; color: var(--navy-text); }
.modal-close{
  background: transparent;
  border: none;
  font-size: 22px;
  line-height: 1;
  color: var(--text-muted);
  padding: 4px 8px;
}
.modal-close:hover{ color: var(--text); }

.form-grid{
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
@media (min-width: 560px){
  .form-grid{ grid-template-columns: 1fr 1fr; }
}

.form-field{ display: flex; flex-direction: column; gap: 5px; }
.form-field label{ font-size: 12.5px; font-weight: 600; color: var(--text-muted); }
.form-field input, .form-field select, .form-field textarea{
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14.5px;
  background: var(--bg);
  color: var(--text);
}
.form-field input:focus, .form-field select:focus, .form-field textarea:focus{
  outline: none;
  border-color: var(--green-mid);
  box-shadow: 0 0 0 3px rgba(78,139,78,0.15);
}

.modal-actions{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 20px;
  flex-wrap: wrap;
}
.modal-actions-right{ display: flex; gap: 10px; margin-left: auto; }

.import-summary{
  background: var(--surface-alt);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 13px;
  color: var(--text);
}

/* ---------- Confirm-before-you-commit dialog (add / edit / delete / publish) ---------- */
.confirm-overlay{ z-index: 115; }
.confirm-message{
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
}

/* ---------- Unit detail modal (Building + Flat -> one or more vehicles) ---------- */
.detail-subtitle{ margin: 2px 0 0; font-size: 12.5px; color: var(--text-muted); }

.count-pill{
  display: inline-block;
  margin-left: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: var(--surface-alt);
  color: var(--blue-text);
  border: 1px solid var(--border);
  white-space: nowrap;
}

.detail-vehicle-list{
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 4px 0 4px;
  max-height: 52vh;
  overflow-y: auto;
  padding-right: 2px;
}

.detail-vehicle-card{
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  background: var(--bg);
}

.detail-vehicle-head{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 2px;
}
.detail-vehicle-name{
  font-weight: 700;
  font-size: 14.5px;
  color: var(--navy-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.detail-vehicle-actions{ display: flex; gap: 2px; flex-shrink: 0; }
.detail-vehicle-actions .icon-btn{ padding: 5px; }
.detail-vehicle-actions .icon{ width: 15px; height: 15px; }
.detail-vehicle-delete:hover{ color: var(--red); background: var(--tint-red); }

.detail-vehicle-type{ font-size: 12px; color: var(--text-muted); font-weight: 600; white-space: nowrap; }

.detail-person-contact, .detail-person-email{ margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.contact-reveal-btn{ width: 22px; height: 22px; color: var(--text-muted); }
.contact-reveal-btn .icon{ width: 14px; height: 14px; }
.contact-reveal-btn:hover{ color: var(--navy-text); }

/* Deliberately quiet - a small reference line, not a highlighted fact. */
.detail-person-updated{
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-muted);
  opacity: .8;
}

.detail-vehicle-extra{ font-size: 12px; color: var(--text-muted); line-height: 1.6; }

/* One resident card can hold several vehicle rows (multiple vehicles for
   the same person) - each row is its own strip with the vehicle pills on
   the left and edit/delete on the right, separated by a thin divider. */
.detail-vehicle-rows{
  display: flex;
  flex-direction: column;
  margin-top: 6px;
}
.detail-vehicle-row{
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 6px 10px;
  padding: 8px 0;
  border-top: 1px dashed var(--border);
}
.detail-vehicle-rows .detail-vehicle-row:first-child{ border-top: none; padding-top: 4px; }
.detail-vehicle-row-main{
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
}
.detail-vehicle-row .detail-vehicle-extra{ flex-basis: 100%; margin-top: 2px; order: 3; }

/* ==========================================================================
   Toast
   ========================================================================== */
.toast{
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: var(--navy);
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  line-height: 1.4;
  box-shadow: var(--shadow-md);
  z-index: 120;
  max-width: min(90vw, 460px);
  cursor: pointer;
}
/* A real problem (e.g. the Sheet couldn't be reached) gets its own colour
   so it doesn't look like just another routine confirmation. */
.toast-success{ background: var(--green-deep); }
.toast-error{ background: #8A2E1F; }

/* ==========================================================================
   Commercial Activities module
   ========================================================================== */
@media (min-width: 720px){ .ca-table{ min-width: 820px; } }
/* The "+ Record Activity" action is a link styled as a button. */
a.btn{ text-decoration: none; }
/* Main line + muted second line in one cell (company + contact person,
   committee member + their flat). */
.ca-stack{ display: inline-flex; flex-direction: column; gap: 1px; }
.ca-main{ font-weight: 600; color: var(--text); }
.ca-sub{ font-size: 12px; color: var(--text-muted); }
.ca-date{ display: inline-flex; flex-direction: column; gap: 4px; }
.ca-badges{ display: inline-flex; gap: 4px; flex-wrap: wrap; }
.ca-amount{ font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }

.ca-badge-running{ background: var(--tint-amber); color: var(--amber-text); }
.ca-badge-upcoming{ background: var(--tint-blue); color: var(--blue-text); }
.ca-badge-completed{ background: var(--surface-alt); color: var(--text-muted); }
.ca-badge-undated{ background: var(--tint-red); color: var(--red); }
.ca-clash{ background: var(--tint-red); color: var(--red); }

/* Label/value rows inside the detail cards. */
.ca-fields{
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 6px 14px;
  margin: 8px 0 0;
  font-size: 13px;
}
.ca-fields dt{ color: var(--text-muted); font-weight: 600; }
.ca-fields dd{ margin: 0; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; word-break: break-word; }
.ca-fields dd a{ color: var(--blue-text); font-weight: 600; }

@media (max-width: 719px){
  .ca-stack, .ca-date{ align-items: flex-end; }
  .ca-badges{ justify-content: flex-end; }
  /* The company is what a card is "about" - lead with it like Unit does
     for vehicles. */
  .ca-table td[data-label="Company"] .ca-main{ font-size: 15px; color: var(--navy-text); }
}

/* ==========================================================================
   Public site (home page) - same brand tokens as the portal, light and dark
   ========================================================================== */
/* Keyboard focus ring on controls only (the programmatically focused page
   containers, tabindex="-1", stay outline free) */
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible{
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.gate-back{
  display: inline-block;
  margin-top: 10px;
  text-decoration: none;
}
/* The strip across the top of the sign in screens, like the rest of the site: Home on the left, the theme choice on the right */
.gate-bar{ position: sticky; top: 0; z-index: 5; align-self: stretch; flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px;
  padding: 8px 16px; padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right));
  margin: 0 0 28px; margin-bottom: clamp(16px, 4dvh, 36px);
  background: var(--header-bg); -webkit-backdrop-filter: saturate(160%) blur(10px); backdrop-filter: saturate(160%) blur(10px); border-bottom: 1px solid var(--border); }
.gate-bar-home{ display: inline-flex; align-items: center; gap: 8px; min-height: 40px; font-size: 14.5px; font-weight: 600; color: var(--blue-text); text-decoration: none; }
.gate-bar-home .icon{ width: 18px; height: 18px; }
.gate-bar-home:hover{ text-decoration: underline; }

/* ---------- Theme switch (System / Light / Dark) ---------- */
.theme-switch{
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-alt);
}
.theme-switch button{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
}
.theme-switch button:hover{ color: var(--text); }
.theme-switch button.is-active{ background: var(--surface); color: var(--green-text); box-shadow: var(--shadow-sm); }
.theme-switch .icon{ width: 16px; height: 16px; }

/* ---------- Public site shell ---------- */
.site{
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.site-header{
  min-height: 68px;
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  background: var(--header-bg);
  -webkit-backdrop-filter: saturate(160%) blur(10px);
  backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.site-brand{
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  text-decoration: none;
  color: inherit;
}
.site-brand-logo{ width: 44px; height: 44px; border-radius: 10px; object-fit: contain; flex-shrink: 0; }
.site-brand-text{ display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.site-brand .brand-name{ font-weight: 700; font-size: 16px; color: var(--navy-text); }
.site-brand .brand-tag{ font-size: 12px; color: var(--text-muted); }
.site-header-actions{ display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.site-header .btn{ text-decoration: none; white-space: nowrap; }

.site-content{
  flex: 1;
  width: 100%;
  max-width: 1040px;
  margin: 0 auto;
  padding: 24px 16px 8px;
  outline: none;
}
/* The home page runs full width (hero band), other public pages stay in a column */
.site-content.is-home{ max-width: none; padding: 0; }

/* ---------- Buttons ---------- */
.btn-lg{ padding: 13px 22px; font-size: 15px; border-radius: 12px; text-decoration: none; }
.btn-lg .icon{ width: 18px; height: 18px; }
.btn-outline{
  background: transparent;
  color: var(--blue-text);
  border-color: var(--blue);
}
.btn-outline:hover{ background: var(--tint-blue); }
.btn-disabled{
  background: var(--surface-alt);
  color: var(--text-muted);
  border-color: var(--border);
  cursor: default;
}
.btn-disabled:active{ transform: none; }

/* ---------- Hero: the society by day and by night ----------
   One picture, two moods. The variables below hold the day look; the dark
   theme swaps them. Gradients cannot animate, so the day and night skies are
   two stacked layers that cross-fade, and the sun and moon trade places by
   moving and fading. The fade itself is switched on only while the theme is
   changing (.theme-switching, see the end of this block). */
.home-hero{
  --hero-text: #0B2C48;
  --hero-text-soft: rgba(11,44,72,0.80);
  --sun-o: 1;      --sun-y: 0px;
  --moon-o: 0;     --moon-y: 150px;
  --stars-o: 0;    --clouds-o: 1;   --birds-o: 0.55;
  --hill: #86C77A;
  --ground: #4E9A52;  --ground-edge: #3F8545;
  --tree-0: #3E9B52;  --tree-1: #5DB85F;  --tree-2: #2F8548;
  --tree-shine: rgba(255,255,255,0.22);   --trunk: #8A6642;
  --b0: #F6E3C3;  --b1: #F7FAFD;  --b2: #F3D8BD;  --b3: #E4EEF5;
  --b-side: rgba(24,58,90,0.10);          --b-roof: #7C93A6;  --b-top: #93A9BA;
  --win: #CFE6F4;  --win-lit: #FFF0C2;    --win-night: #CFE6F4;
  --door: #4F7694; --awning: #2E8B57;
  position: relative;
  overflow: hidden;
  isolation: isolate;
  color: var(--hero-text);
  padding: 44px 20px 112px;
  background: #A9D8F1;
}
:root[data-theme="dark"] .home-hero{
  --hero-text: #F4F7FF;
  --hero-text-soft: rgba(226,234,252,0.86);
  --sun-o: 0;      --sun-y: 150px;
  --moon-o: 1;     --moon-y: 0px;
  --stars-o: 1;    --clouds-o: 0;   --birds-o: 0;
  --hill: #162B3B;
  --ground: #15302F;  --ground-edge: #0F2423;
  --tree-0: #1D5645;  --tree-1: #236A50;  --tree-2: #17493A;
  --tree-shine: rgba(130,210,170,0.10);   --trunk: #3A2E2A;
  --b0: #1D2B4A;  --b1: #243760;  --b2: #1A2743;  --b3: #273A62;
  --b-side: rgba(0,0,0,0.28);             --b-roof: #101A33;  --b-top: #17233F;
  --win: #2B3E66;  --win-lit: #FFD36E;    --win-night: #FFD36E;
  --door: #2A3A5C; --awning: #1F6F57;
  background: #14264A;
}

/* Sky layers sit behind everything else in the hero */
.sky{ position: absolute; inset: 0; z-index: -1; pointer-events: none; }
.sky > div{ position: absolute; inset: 0; }
.sky-day{ background: linear-gradient(180deg, #5FB1E6 0%, #8FCBEF 48%, #CFEBF8 100%); }
.sky-night{
  background:
    radial-gradient(520px 260px at 84% 22%, rgba(120,150,230,0.22), transparent 70%),
    linear-gradient(180deg, #070D20 0%, #0F1D3E 52%, #1B3562 100%);
  opacity: var(--stars-o);
}
.sky-stars{ opacity: var(--stars-o); }
.star{
  position: absolute;
  border-radius: 50%;
  background: #fff;
  opacity: 0.85;
}
.sky-clouds{ opacity: var(--clouds-o); }
.cloud{
  position: absolute;
  height: 24px;
  border-radius: 999px;
  background: rgba(255,255,255,0.88);
}
.cloud::before, .cloud::after{
  content: "";
  position: absolute;
  bottom: 8px;
  border-radius: 50%;
  background: inherit;
}
.cloud::before{ left: 16%; width: 38%; padding-top: 38%; }
.cloud::after{ left: 44%; width: 30%; padding-top: 30%; }
.cloud-a{ width: 104px; top: 13%; left: 46%; }
.cloud-b{ width: 128px; top: 34%; left: 68%; opacity: 0.75; }
.cloud-c{ width: 82px;  top: 22%; left: 8%;  opacity: 0.65; }
@media (max-width: 899px){
  .cloud-c{ display: none; }
  .cloud-a{ left: 6%; top: 40%; width: 84px; }
  .cloud-b{ left: 62%; top: 44%; width: 104px; }
}

.home-hero-inner{
  position: relative;
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  text-align: center;
}
.home-hero h1{
  margin: 0 0 14px;
  font-size: clamp(26px, 8.4vw, 50px);
  line-height: 1.12;
  letter-spacing: -0.8px;
  color: var(--hero-text);
}
.home-hero h1 span{ display: block; white-space: nowrap; }
.home-hero p{
  margin: 0 auto;
  max-width: 34ch;
  font-size: 17px;
  line-height: 1.55;
  color: var(--hero-text-soft);
  text-wrap: pretty;
}
.home-art{ width: min(100%, 380px); height: auto; flex-shrink: 0; }

/* Picture parts. Every colour is a variable, so the dark theme only swaps values. */
.art-sun{ opacity: var(--sun-o); transform: translateY(var(--sun-y)); }
.art-moon{ opacity: var(--moon-o); transform: translateY(var(--moon-y)); }
.art-hill{ fill: var(--hill); }
.art-birds{ stroke: #2B5878; opacity: var(--birds-o); }
.art-ground{ fill: var(--ground); }
.art-edge{ fill: var(--ground-edge); }
.t0{ fill: var(--b0); } .t1{ fill: var(--b1); } .t2{ fill: var(--b2); } .t3{ fill: var(--b3); }
.t-side{ fill: var(--b-side); }
.t-roof{ fill: var(--b-roof); }
.t-top{ fill: var(--b-top); }
.t-door{ fill: var(--door); }
.t-awning{ fill: var(--awning); }
.win{ fill: var(--win); }
.win-lit{ fill: var(--win-lit); }
.win-n{ fill: var(--win-night); }
.tree-trunk{ fill: var(--trunk); }
.tree-c0{ fill: var(--tree-0); } .tree-c1{ fill: var(--tree-1); } .tree-c2{ fill: var(--tree-2); }
.tree-shine{ fill: var(--tree-shine); }

/* Small motion, only where it adds life: clouds drift by day, a few stars twinkle by night (the sun stays still) */
@media (prefers-reduced-motion: no-preference){
  :root[data-theme="light"] .cloud-a, :root[data-theme="light"] .cloud-c{ animation: cloud-drift 46s ease-in-out infinite alternate; }
  :root[data-theme="light"] .cloud-b{ animation: cloud-drift 58s ease-in-out infinite alternate-reverse; }
  :root[data-theme="dark"] .star-tw{ animation: star-twinkle 4.2s ease-in-out infinite; }
}
@keyframes cloud-drift{ from{ transform: translateX(-14px); } to{ transform: translateX(18px); } }
@keyframes star-twinkle{ 0%,100%{ opacity: 0.85; } 50%{ opacity: 0.25; } }

/* Theme change: colours fade for a moment instead of snapping. The hero gets a
   slightly slower, smoother fade so the sun sets and the moon rises. */
:root.theme-switching *, :root.theme-switching *::before, :root.theme-switching *::after{
  transition: background-color .4s ease, color .4s ease, border-color .4s ease, fill .4s ease, stroke .4s ease, box-shadow .4s ease !important;
}
:root.theme-switching .home-hero, :root.theme-switching .home-hero *{
  transition: background-color .9s ease, color .9s ease, fill .9s ease, stroke .9s ease, opacity .9s ease, transform 1s cubic-bezier(.45,.05,.3,1) !important;
}

/* ---------- Two spaces: residents and committee ---------- */
.home-wrap{
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1100px;
  margin: -68px auto 0;
  padding: 0 16px 8px;
}
.home-spaces{ display: grid; grid-template-columns: 1fr; gap: 20px; }

.space-card{
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow-md);
}
.space-head{ display: flex; align-items: center; gap: 14px; }
.space-head h2{ margin: 0; font-size: 21px; line-height: 1.2; color: var(--text); }
.space-tag{ display: inline-block; margin-top: 3px; font-size: 12.5px; color: var(--text-muted); }
.space-icon{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  color: #fff;
  flex-shrink: 0;
}
.space-icon .icon{ width: 24px; height: 24px; }
.space-residents .space-icon{ background: linear-gradient(135deg, #1D6FA8, #3FA9D6); }
.space-committee .space-icon{ background: linear-gradient(135deg, #2E6B3E, #8CB93C); }
.space-residents{ background: linear-gradient(180deg, color-mix(in srgb, var(--blue) 9%, transparent), transparent 170px), var(--surface); }
.space-committee{ background: linear-gradient(180deg, color-mix(in srgb, var(--green-deep) 10%, transparent), transparent 170px), var(--surface); }
.space-card > p{ margin: 0; font-size: 15px; line-height: 1.5; color: var(--text-muted); }

.chip-soon{
  display: inline-block;
  margin-left: 7px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--tint-amber);
  color: var(--amber-text);
  font-size: 12px;
  font-weight: 700;
}

/* Service tiles (residents and committee).
   Live tiles are solid gradient buttons in the same family as the hero (deep tone to a lighter
   tone, white text, glass icon chip, soft coloured shadow). Planned tiles are flat, neutral and
   dashed, with a muted icon and one common outline "Coming soon" pill, so the two kinds are
   different at a glance. Each tone only sets a few colours. */
.tiles{ display: grid; grid-template-columns: repeat(2, 1fr); grid-auto-rows: 1fr; gap: 12px; margin-top: 4px; }
.tile{
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 16px 16px 18px;
  min-height: 132px;
  border-radius: 16px;
  border: 1.5px solid transparent;
  text-decoration: none;
  min-width: 0;
}
.tile-icon{
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; margin-bottom: 10px;
  border-radius: 12px;
}
.tile-icon .icon{ width: 22px; height: 22px; }
.tile-title{ font-size: 15.5px; font-weight: 700; line-height: 1.25; }
.tile-blurb{ font-size: 13.5px; line-height: 1.35; }

.tile-green{  --tile-base: var(--tint-green);  --tile-fg: var(--green-text);  --tile-a: #1B5A34; --tile-b: #277A47; }
.tile-amber{  --tile-base: var(--tint-amber);  --tile-fg: var(--amber-text);  --tile-a: #8A4F08; --tile-b: #A15F0D; }
.tile-blue{   --tile-base: var(--tint-blue);   --tile-fg: var(--blue-text);   --tile-a: #11548A; --tile-b: #226FAC; }
.tile-violet{ --tile-base: var(--tint-violet); --tile-fg: var(--violet-text); --tile-a: #46318A; --tile-b: #644CB3; }
.tile-red{    --tile-base: var(--tint-red);    --tile-fg: var(--red-text);    --tile-a: #9C2A24; --tile-b: #BC3D35; }

/* Live */
.tile-live{
  background: linear-gradient(145deg, var(--tile-a) 0%, var(--tile-b) 100%);
  border-color: rgba(255,255,255,0.16);
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.22), 0 10px 20px -10px color-mix(in srgb, var(--tile-a) 85%, transparent);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.tile-live .tile-title{ color: #fff; }
.tile-live .tile-blurb{ color: rgba(255,255,255,0.92); }
.tile-live .tile-icon{ background: rgba(255,255,255,0.20); color: #fff; box-shadow: inset 0 0 0 1px rgba(255,255,255,0.24); }
.tile-go{
  position: absolute;
  top: 12px;
  right: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(255,255,255,0.22);
  color: #fff;
  transition: transform 0.15s ease, background 0.15s ease;
}
.tile-go .icon{ width: 15px; height: 15px; }
.tile-live:hover{ transform: translateY(-3px); box-shadow: inset 0 1px 0 rgba(255,255,255,0.26), 0 16px 26px -10px color-mix(in srgb, var(--tile-a) 95%, transparent); }
.tile-live:hover .tile-go{ background: rgba(255,255,255,0.34); transform: translateX(2px); }
.tile-live:active{ transform: translateY(0); }
.tile-live:focus-visible{ outline: 2px solid var(--blue-text); outline-offset: 2px; }

/* Planned */
.tile-soon{
  background: color-mix(in srgb, var(--tile-base) 22%, var(--surface-alt));
  border: 1.5px dashed color-mix(in srgb, var(--text-muted) 45%, transparent);
  cursor: default;
}
.tile-soon .tile-icon{
  background: color-mix(in srgb, var(--text-muted) 16%, transparent);
  color: color-mix(in srgb, var(--tile-fg) 40%, var(--text-muted));
}
.tile-soon .tile-title{ color: color-mix(in srgb, var(--text) 78%, var(--surface)); font-weight: 600; }
.tile-soon .tile-blurb{ color: var(--text-muted); }
:root[data-theme="dark"] .tile-soon{ background: color-mix(in srgb, var(--tile-base) 26%, var(--surface-alt)); }
:root[data-theme="dark"] .tile-soon .tile-title{ color: color-mix(in srgb, var(--text) 84%, var(--surface-alt)); }
.tile-badge{
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 2px 9px;
  border-radius: 999px;
  background: transparent;
  color: var(--amber-text);
  border: 1px solid color-mix(in srgb, var(--amber-text) 55%, transparent);
  font-size: 12px;
  font-weight: 600;
}

/* Card top row: heading on the left, the login button on the right */
.space-top{ display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; }
.space-login{ width: 100%; }
.space-committee .btn-primary{
  background: linear-gradient(135deg, var(--green-deep), var(--green-mid));
  border: none;
  box-shadow: 0 6px 16px rgba(46,107,62,0.32);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.space-committee .btn-primary:hover{ transform: translateY(-1px); box-shadow: 0 10px 22px rgba(46,107,62,0.40); }

.site .footer{ margin-top: 28px; }

@media (max-width: 479px){
  .site-header-actions{ gap: 8px; }
  .site-header .btn{ padding: 9px 12px; font-size: 13px; }
}
@media (min-width: 640px){
  .site-header{ padding: 12px 28px; }
  .site-content{ padding: 32px 24px 8px; }
  .home-wrap{ padding: 0 24px 8px; }
  .home-hero{ padding: 64px 28px 128px; }
  .home-wrap{ margin-top: -80px; }
}
@media (min-width: 900px){
  .home-hero-inner{ flex-direction: row; justify-content: space-between; text-align: left; gap: 40px; }
  .home-hero p{ margin: 0; }
  .home-art{ width: 520px; }
  .home-spaces{ gap: 22px; }
  .tiles{ grid-template-columns: repeat(4, 1fr); gap: 14px; }
}
@media (min-width: 560px){
  .space-login{ width: auto; }
}
@media (min-width: 640px) and (max-width: 899px){
  .tiles{ grid-template-columns: repeat(3, 1fr); }
}

@media (prefers-reduced-motion: reduce){
  .tile-live, .space-committee .btn-primary{ transition: none; }
  .tile-live:hover, .space-committee .btn-primary:hover{ transform: none; }
}

@media (min-width: 640px){
  .content{ padding: 24px 28px; }
}

/* ---------- Events module ---------- */
.ev{ max-width: 860px; margin: 0 auto; }
.ev-head h1{ margin: 0 0 4px; font-size: 28px; line-height: 1.2; color: var(--text); }
.ev-head p{ margin: 0 0 20px; color: var(--text-muted); font-size: 15.5px; }
.ev-bar{ display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.ev-tabs{ display: inline-flex; gap: 4px; padding: 4px; background: var(--surface-alt); border: 1px solid var(--border); border-radius: 12px; }
.ev-tab{
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px; border: 0; border-radius: 9px;
  background: transparent; color: var(--text-muted);
  font: inherit; font-size: 14.5px; font-weight: 600; cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.ev-tab:hover{ color: var(--text); }
.ev-tab[aria-selected="true"]{ background: var(--surface); color: var(--green-text); box-shadow: var(--shadow-sm); }
.ev-year{ display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text-muted); }
.ev-year strong{ color: var(--text); font-size: 15px; letter-spacing: .2px; }

.ev-spot{
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 20px 22px; margin-bottom: 20px; border-radius: 18px; color: #fff;
  background: linear-gradient(135deg, #1D5636 0%, #2E6B3E 45%, #1D6FA8 100%);
  box-shadow: var(--shadow-md);
}
.ev-spot-label{ font-size: 13px; font-weight: 600; opacity: 0.85; }
.ev-spot-title{ font-size: 26px; font-weight: 800; line-height: 1.2; margin: 2px 0 4px; }
.ev-spot-sub{ font-size: 14.5px; opacity: 0.92; }
.ev-spot-when{ padding: 8px 14px; border-radius: 999px; background: rgba(0,0,0,0.24); font-weight: 700; font-size: 14px; }

.ev-list{ list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.ev-month{ margin: 14px 0 0; font-size: 13px; font-weight: 700; color: var(--text-muted); letter-spacing: 0.02em; }
.ev-month:first-child{ margin-top: 0; }
.ev-item{
  display: flex; align-items: center; gap: 16px; padding: 14px 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
}
.ev-item.ev-done{ background: var(--surface-alt); box-shadow: none; }
.ev-item.ev-done .ev-name,
.ev-item.ev-done .ev-when{ color: var(--text-muted); }
.ev-item.ev-done .ev-date{ filter: saturate(.55); }
.ev-item.ev-is-next{ border: 2px solid var(--green-deep); padding: 13px 15px; box-shadow: var(--shadow-sm); }
.ev-date{
  flex: 0 0 68px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 8px 4px; border-radius: 12px; line-height: 1.1;
}
.ev-wd{ font-size: 12px; font-weight: 600; }
.ev-day{ font-size: 24px; font-weight: 800; line-height: 1.1; }
.ev-mon{ font-size: 12.5px; font-weight: 700; }
.ev-to{ margin-top: 4px; padding-top: 4px; border-top: 1px solid currentColor; font-size: 12px; font-weight: 600; white-space: nowrap; }
.ev-tone-green{ background: var(--tint-green); color: var(--green-text); }
.ev-tone-amber{ background: var(--tint-amber); color: var(--amber-text); }
.ev-tone-blue{ background: var(--tint-blue); color: var(--blue-text); }
.ev-tone-violet{ background: var(--tint-violet); color: var(--violet-text); }
.ev-tone-red{ background: var(--tint-red); color: var(--red-text); }
.ev-body{ flex: 1; min-width: 0; }
.ev-name{ font-size: 17px; font-weight: 700; color: var(--text); }
.ev-when{ font-size: 14px; color: var(--text); margin-top: 1px; }
.ev-note{ font-size: 13.5px; color: var(--text-muted); margin-top: 2px; }
.ev-pill{
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 999px; border: 1px solid var(--border);
  font-size: 12.5px; font-weight: 700; color: var(--text-muted); white-space: nowrap;
}
.ev-pill .icon{ width: 13px; height: 13px; }
.ev-pill-next{ background: var(--tint-amber); border-color: transparent; color: var(--amber-text); }
.ev-pill-now{ background: var(--tint-green); border-color: transparent; color: var(--green-text); }
.ev-pill-done{ background: var(--tint-green); border-color: transparent; color: var(--green-text); }
.ev-foot{ margin: 18px 0 0; font-size: 13px; color: var(--text-muted); }

.ev-empty{ text-align: center; padding: 48px 20px; background: var(--surface); border: 1px dashed var(--border); border-radius: 18px; }
.ev-empty-icon{ display: inline-flex; align-items: center; justify-content: center; width: 56px; height: 56px; border-radius: 16px; background: var(--tint-blue); color: var(--blue-text); }
.ev-empty-icon .icon{ width: 28px; height: 28px; }
.ev-empty h2{ margin: 14px 0 6px; font-size: 20px; color: var(--text); }
.ev-empty p{ margin: 0 auto; max-width: 420px; color: var(--text-muted); font-size: 15px; line-height: 1.5; }

@media (max-width: 559px){
  .ev-item{ display: grid; grid-template-columns: 56px 1fr; column-gap: 14px; row-gap: 8px; align-items: start; }
  .ev-date{ flex: none; width: 56px; }
  .ev-pill{ grid-column: 2; justify-self: start; }
  .ev-spot-title{ font-size: 22px; }
}

.legal-updated{ margin: 0 0 4px; font-size: 13px; color: var(--text-muted); }

/* ---------- Phones: compact tiles, easier to tap ---------- */
@media (max-width: 559px){
  .space-card{ padding: 18px; }
  .tiles{ gap: 10px; }
  .tile{ padding: 14px 10px 14px 12px; }
  .tile-icon{ width: 36px; height: 36px; margin-bottom: 8px; }
  .tile{ min-height: 0; }
  .tile-title{ font-size: 13.5px; overflow-wrap: break-word; hyphens: auto; -webkit-hyphens: auto; }
  .tile-blurb{ font-size: 13px; }
  /* the badge sits under the text instead of over the icon row */
  .tile-soon .tile-badge{ position: static; align-self: flex-start; margin-top: 8px; }
}
@media (max-width: 359px){
  .tile{ padding: 12px; }
  .tile-title{ font-size: 14px; }
  .site-header .btn{ padding: 9px 10px; }
}
/* Touch screens: bigger targets for small controls */
@media (pointer: coarse){
  .theme-switch button{ width: 34px; height: 34px; }
  .footer-link-btn{ display: inline-block; padding: 8px 3px; }
  .gate-link-btn{ padding: 12px 10px; }
  .gate-toggle-visibility{ padding: 10px; }
  .footer a{ display: inline-block; padding: 6px 2px; }
  .footer-link-btn{ padding: 14px 3px; }
  .icon-btn{ min-width: 44px; min-height: 44px; }
  .back-to-buildings-btn{ min-height: 44px; }
}
@media (pointer: coarse) and (min-width: 480px){
  .theme-switch button{ width: 40px; height: 40px; }
}
@media (pointer: coarse) and (max-width: 359px){
  .theme-switch button{ width: 30px; height: 30px; }
}

.module-loading{ padding: 28px 4px; color: var(--text-muted); font-size: 15px; }
.module-loading .btn{ margin-top: 12px; }

/* iPhone Safari zooms the whole page when a field smaller than 16px gets focus.
   Keep fields at 16px on touch screens so tapping one never zooms the page. */
@media (pointer: coarse){
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
  select,
  textarea{ font-size: 16px !important; }
}


/* ==========================================================================
   Interaction layer: one hover, press and focus feel for every control, and
   one gentle way for popups and pages to appear. Kept last on purpose so it
   evens out the rules above without changing any layout.
   ========================================================================== */
:root{ --ease: cubic-bezier(.2,.7,.2,1); }

.btn, .icon-btn, .modal-close, .theme-switch button, .ev-tab,
.footer-link-btn, .text-link-btn, .gate-link-btn{
  transition: background-color .16s var(--ease), border-color .16s var(--ease), color .16s var(--ease),
              box-shadow .16s var(--ease), transform .12s var(--ease);
}

/* Hover (only on devices that really hover, so phones never get a stuck highlight) */
@media (hover: hover){
  .btn-primary:hover{ box-shadow: 0 6px 16px rgba(46,107,62,0.32); transform: translateY(-1px); }
  .btn-secondary:hover{ border-color: color-mix(in srgb, var(--text-muted) 55%, var(--border)); }
  .btn-outline:hover{ border-color: var(--blue-text); }
  .btn-danger:hover{ border-color: var(--red); }
  .icon-btn:hover, .modal-close:hover{ background: var(--surface-alt); color: var(--text); }
}

/* Press: the same small push down on every button, with a slightly deeper fill */
.btn:active{ transform: translateY(1px) scale(0.985); }
.btn-primary:active{ box-shadow: 0 1px 4px rgba(46,107,62,0.28); }
.btn-secondary:active, .btn-ghost:active{ background: color-mix(in srgb, var(--text) 11%, var(--surface)); }
.btn-outline:active{ background: color-mix(in srgb, var(--blue) 22%, var(--surface)); }
.btn-danger:active{ background: color-mix(in srgb, var(--red) 18%, var(--surface)); }
.sidebar .btn-ghost:active{ background: var(--side-active); }
.btn-disabled:active{ transform: none; background: var(--surface-alt); }
.icon-btn:active, .modal-close:active{ background: color-mix(in srgb, var(--text) 14%, var(--surface)); transform: scale(0.92); }
.theme-switch button:active{ transform: scale(0.92); }
.ev-tab:active{ transform: scale(0.97); }
.nav-item:active{ background: var(--side-active); }

/* Popup close button: same round target everywhere */
.modal-close{
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; padding: 0; border-radius: 50%;
  font-size: 24px; line-height: 1; flex-shrink: 0;
}

/* Danger button was white in dark mode; keep it in the dark palette */
:root[data-theme="dark"] .btn-danger{ background: transparent; border-color: #6E3C33; color: var(--red); }
:root[data-theme="dark"] .btn-danger:hover{ background: var(--tint-red); }

/* Links: same colour change on hover for every link-style button */
.gate-link-btn:hover, .footer-link-btn:hover, .text-link-btn:hover{ color: var(--navy-text); }

/* Arrival: popups fade and settle in, pages fade in */
@media (prefers-reduced-motion: no-preference){
  .modal-overlay:not([hidden]){ animation: overlay-in .18s ease both; }
  .modal-overlay:not([hidden]) .modal{ animation: modal-in .22s var(--ease) both; }
  /* backwards (not both): once finished, no leftover stacking context, so popups inside the page can still sit above the sidebar */
  .view-in{ animation: view-in .22s ease backwards; }
}
@keyframes overlay-in{ from{ opacity: 0; } to{ opacity: 1; } }
@keyframes modal-in{ from{ opacity: 0; transform: translateY(10px) scale(0.98); } to{ opacity: 1; transform: none; } }
@keyframes view-in{ from{ opacity: 0; } to{ opacity: 1; } }

/* Interaction layer, part 2: controls that still lacked a hover or press cue */
select, .site-brand, .back-to-buildings-btn, .registry-row, .gate-toggle-visibility{
  transition: background-color .16s var(--ease), border-color .16s var(--ease), color .16s var(--ease), opacity .16s var(--ease), transform .12s var(--ease);
}
@media (hover: hover){
  select:hover{ border-color: color-mix(in srgb, var(--text-muted) 55%, var(--border)); }
  .site-brand:hover{ opacity: 0.82; }
}
.site-brand:active{ opacity: 0.65; }
.footer-link-btn:active, .gate-link-btn:active, .text-link-btn:active, .gate-toggle-visibility:active{ opacity: 0.6; }
.back-to-buildings-btn:active{ background: color-mix(in srgb, var(--text) 11%, var(--surface)); transform: scale(0.97); }
.registry-row:active, .registry-table tbody tr.registry-row:active{ background: color-mix(in srgb, var(--text) 9%, var(--surface)); }
.btn.space-login:active{ transform: translateY(1px) scale(0.985); }
.footer-version{ white-space: nowrap; font-variant-numeric: tabular-nums; }

/* Popup buttons: the cross and Cancel/Close read clearly as buttons (outlined, same hover and press as the rest) */
.modal-close{ border: 1px solid var(--border); background: var(--surface); color: var(--text); }
.modal-actions .btn-ghost, .confirm-overlay .btn-ghost{ background: var(--surface); border-color: var(--border); }
@media (hover: hover){
  .modal-close:hover, .modal-actions .btn-ghost:hover, .confirm-overlay .btn-ghost:hover{
    background: var(--surface-alt); border-color: color-mix(in srgb, var(--text-muted) 55%, var(--border));
  }
}
.modal-actions .btn-ghost:active, .confirm-overlay .btn-ghost:active{ background: color-mix(in srgb, var(--text) 11%, var(--surface)); }

/* Outlined buttons (Add Vehicle Here, Cancel, Close, and the like) get a firmer edge and a light lift so they read as buttons everywhere */
.btn-secondary, .modal-actions .btn-ghost, .confirm-overlay .btn-ghost, .modal-close{
  border-color: color-mix(in srgb, var(--text-muted) 40%, var(--border));
  box-shadow: var(--shadow-sm);
}
@media (hover: hover){
  .btn-secondary:hover, .modal-actions .btn-ghost:hover, .confirm-overlay .btn-ghost:hover, .modal-close:hover{
    border-color: var(--text-muted); box-shadow: var(--shadow-md);
  }
}
.btn-secondary:active, .modal-actions .btn-ghost:active, .confirm-overlay .btn-ghost:active, .modal-close:active{ box-shadow: none; }
.form-hint{ margin: 2px 0 0; font-size: 12.5px; line-height: 1.45; color: var(--text-muted); }

/* Popup cross: drawn with two lines so it sits exactly in the middle of the round button on every device and font */
.modal-close{ position: relative; font-size: 0; line-height: 0; }
.modal-close::before, .modal-close::after{
  content: ""; position: absolute; left: 50%; top: 50%;
  width: 14px; height: 2px; border-radius: 2px; background: currentColor;
}
.modal-close::before{ transform: translate(-50%, -50%) rotate(45deg); }
.modal-close::after{ transform: translate(-50%, -50%) rotate(-45deg); }

/* Public header: on phones it is just logo, name and a menu button. Theme and login sit in the menu that drops down. */
.site-brand-text{ flex: 1 1 auto; }
.site-brand .brand-name{ white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.site-brand .brand-tag{ white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.site-menu-btn{ display: none; }
.site-menu{
  position: absolute; left: 0; right: 0; top: 100%;
  padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 14px;
  background: var(--surface); border-bottom: 1px solid var(--border); box-shadow: var(--shadow-md);
}
.site-menu[hidden]{ display: none; }
.site-menu-row{ display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 14px; font-weight: 600; color: var(--text); }
@media (min-width: 680px){ .site-menu{ display: none !important; } }
@media (min-width: 680px) and (max-width: 759px){ .site-brand .brand-tag{ display: none; } }
/* Phones: the full brand (logo, name and tagline) stays, scaled to fit beside the menu button */
@media (max-width: 679px){
  .site-header{ gap: 10px; }
  .site-brand{ gap: 10px; min-width: 0; flex: 1 1 auto; }
  .site-brand-logo{ width: 42px; height: 42px; }
  .site-brand .brand-name{ font-size: 15.5px; }
  .site-brand .brand-tag{ font-size: 12px; }
}
@media (max-width: 339px){ .site-brand-logo{ width: 36px; height: 36px; } .site-brand .brand-name{ font-size: 14.5px; } .site-brand .brand-tag{ font-size: 11px; } }
@media (max-width: 679px){
  .site-header-actions > [data-theme-control], #siteLoginBtn{ display: none; }
  .site-menu-btn{ display: inline-flex; }
}

/* Committee portal on phones: no theme switch here, the theme is set on the main site */
@media (max-width: 559px){ .topbar-actions [data-theme-control]{ display: none; } }

/* ---------- Data menu: form item + form layout guide ---------- */
.menu-item:disabled{ color: var(--text-muted); cursor: not-allowed; background: transparent; }
.menu-item:disabled:hover{ background: transparent; }
.menu-item span{ display: block; }
.menu-sub{ display: block; margin-top: 2px; font-size: 12px; line-height: 1.35; color: var(--text-muted); font-weight: 400; }
.form-spec-details{ margin: 0 0 14px; }
.form-spec{ list-style: none; margin: 0 0 10px; padding: 0; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.form-spec li{ display: flex; justify-content: space-between; gap: 12px; padding: 8px 12px; font-size: 13px; line-height: 1.4; color: var(--text); }
.form-spec li + li{ border-top: 1px solid var(--border); }
.form-spec li span{ color: var(--text-muted); text-align: right; flex: 0 1 55%; }
@media (max-width:479px){ .form-spec li{ flex-direction: column; gap: 2px; } .form-spec li span{ text-align: left; flex-basis: auto; } }
.share-actions{ flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.share-actions .btn{ flex: 1 1 auto; }
[data-role="share-modal"] textarea{ font-family: inherit; line-height: 1.5; width: 100%; resize: vertical; min-height: 110px; }

/* ---------- Popup width: use the space a desktop screen has ----------
   Every normal popup (forms, detail cards, Connect, Share, Terms, Setup guide)
   takes about two thirds of a desktop window (never narrower than the Terms popup), capped so very wide monitors
   still read well. Small confirm dialogs stay compact. Phones and narrow
   windows keep the existing full-width, responsive behaviour. */
@media (min-width: 640px) and (max-width: 899px){
  .modal[role="dialog"]:not(.modal-guide):not(.modal-legal){ max-width: min(88vw, 720px); }
}
@media (min-width: 900px){
  .modal[role="dialog"]{ max-width: min(max(66vw, 860px), 1100px); }
}

/* Popup buttons wrap instead of overflowing on narrow phones */
.modal-actions-right{ flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 479px){
  .modal-actions-right{ width: 100%; margin-left: 0; }
  .modal-actions-right .btn{ flex: 1 1 auto; }
}

.ev-spot-note{ margin-top: 6px; font-size: 14px; opacity: 0.92; }

/* ---------- Popups: tidy desktop layout and keep scrollbars off the rounded corners ---------- */
@media (min-width: 640px){
  .modal-bar{ padding: 12px 22px 12px 28px; }
}
@media (min-width: 900px){
  /* Terms and Setup guide are reading popups: a little narrower than form popups so lines stay readable */
  .modal.modal-legal[role="dialog"], .modal.modal-guide[role="dialog"]{ max-width: min(max(66vw, 860px), 960px); }
}
.modal-scroll{ margin: 0 6px 10px 0; padding-right: 14px; padding-bottom: 14px; }
.modal > .modal-scroll:only-child{ margin-top: 10px; padding-top: 10px; }
@media (min-width: 640px){
  .modal-scroll{ padding-right: 22px; padding-bottom: 18px; }
  .modal > .modal-scroll:only-child{ padding-top: 14px; }
}
/* The guide page sits inset inside its popup so its scrollbar is not clipped by the curve */
.modal-guide .guide-frame{ flex: 1; width: calc(100% - 20px); margin: 0 10px 10px; border-radius: 10px; }

/* Closed side menu (phones and tablets): fully hidden, so it can never show half open or take keyboard focus */
@media (max-width: 959px){
  .sidebar:not(.sidebar-open){ visibility: hidden; transition: transform .2s ease, visibility 0s linear .2s; }
}

/* ---------- Screens: first paint and screen-change fade ----------
   The head script in index.html sets data-space so only the right screen is
   visible before app.js runs. A screen change then fades the new screen in
   (opacity only, so the side menu's fixed positioning is never affected). */
html[data-space="site"] #gate, html[data-space="site"] #app,
html[data-space="app"] #gate, html[data-space="app"] #site,
html[data-space="gate"] #site, html[data-space="gate"] #app{ display: none; }
@media (prefers-reduced-motion: no-preference){
  .space-in{ animation: space-in .26s ease backwards; }
}
@keyframes space-in{ from{ opacity: 0; } to{ opacity: 1; } }



/* Side menu logo row and top bar share one height so their lines run straight across */
@media (min-width: 960px){
  .sidebar-brand{ box-sizing: border-box; height: 84px; padding-top: 0; padding-bottom: 0; }
  .topbar{ box-sizing: border-box; min-height: 84px; }
}

/* ---------- Water Management ---------- */
.wt-top{ display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; margin-bottom: 16px; }
.wt-lead{ margin: 0; flex: 1 1 280px; color: var(--text-muted); font-size: 14px; line-height: 1.5; }
.wt-open{ flex: 0 0 auto; }
.wt-open .icon{ width: 16px; height: 16px; }
.wt .summary{ margin-top: 4px; }
.wt-section{ margin-top: 26px; }
.wt-section h3{ margin: 0 0 4px; font-size: 17px; color: var(--navy-text); }
.wt-note{ margin: 4px 0 12px; font-size: 13.5px; color: var(--text-muted); line-height: 1.5; }
.wt > .wt-note{ margin-top: 18px; }
.wt-months{ display: grid; grid-template-columns: 1fr; gap: 12px; margin-top: 12px; }
@media (min-width: 720px){ .wt-months{ grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); } }
.wt-month{ background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-sm); padding: 14px 16px; }
.wt-month-head{ display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 10px; color: var(--text); font-size: 14px; }
.wt-month-head strong{ color: var(--green-text); font-size: 15px; }
.wt-bar-row{ display: grid; grid-template-columns: 84px 1fr 64px; align-items: center; gap: 10px; padding: 4px 0; font-size: 13px; }
.wt-bar-label{ color: var(--text-muted); white-space: nowrap; }
.wt-bar-track{ height: 10px; border-radius: 6px; background: var(--surface-alt); overflow: hidden; }
.wt-bar-fill{ display: block; height: 100%; border-radius: 6px; background: var(--green-mid); }
.wt-bar-value{ text-align: right; color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
@media (min-width: 720px){ .registry-table.wt-table{ min-width: 640px; } }
.wt-table .wt-num, .wt-num{ text-align: right; font-variant-numeric: tabular-nums; }
.wt-section .registry{ margin-top: 10px; }
.wt .cat-pending .summary-value{ font-size: 20px; line-height: 1.5; }
.wt-filters .toolbar-row{ align-items: flex-end; }
.wt-field{ display: flex; flex-direction: column; gap: 4px; flex: 1 1 150px; min-width: 0; font-size: 12px; font-weight: 600; color: var(--text-muted); }
.wt-field input, .wt-field select{ width: 100%; }
.wt-export{ flex: 0 0 auto; }
.wt-export .icon{ width: 16px; height: 16px; }

/* ==========================================================================
   Loading screen
   Only seen when the site is slow to start: it fades in after 0.3 seconds, so a
   quick load never shows it. The society logo sits as it is, and a skyline of
   towers rises below it and lights up window by window. app.js removes the
   screen as soon as the site is ready (see finishSplash).
   ========================================================================== */
.splash{
  --city-h: clamp(110px, 32vh, 260px);
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 20px 24px calc(var(--city-h) * .95);
  background: var(--gate-bg);
  color: var(--text);
  overflow: hidden;
  opacity: 0;
  animation: splash-in .3s ease .3s forwards;
}
.splash-card{
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  box-shadow: var(--shadow-md);
  opacity: 0;
  animation: splash-pop .6s cubic-bezier(.2,.8,.25,1) .35s forwards;
}
.splash-logo{ display: block; width: clamp(110px, min(44vw, 34vh), 230px); height: auto; }
.splash-load{
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .08em;
  color: var(--text-muted);
  opacity: 0;
  animation: splash-up .4s ease .9s forwards;
}
.sd{ display: inline-block; animation: splash-dot 1.2s ease-in-out infinite; }
.sd:nth-child(2){ animation-delay: .15s; }
.sd:nth-child(3){ animation-delay: .3s; }
.sd:nth-child(4){ animation-delay: .45s; }
.splash-city{
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: var(--city-h);
  overflow: visible;
}
.st{
  transform-box: fill-box;
  transform-origin: 50% 100%;
  animation: splash-rise .8s cubic-bezier(.2,.8,.25,1) calc(.3s + var(--t) * .09s) both;
}
.st-a .sb{ fill: var(--green-deep); }
.st-b .sb{ fill: var(--blue); }
.st-c .sb{ fill: var(--green-mid); }
.st-d .sb{ fill: var(--blue-dark); }
.sw{
  fill: #FFF1C4;
  opacity: .12;
  animation:
    splash-light .5s ease calc(1s + var(--k) * .03s) forwards,
    splash-twinkle 3.2s ease-in-out calc(2.6s + var(--k) * .12s) infinite;
}
.sg{ fill: var(--green-deep); }
.stree.st-lime{ fill: var(--lime); }
.stree.st-mid{ fill: var(--green-mid); }
@keyframes splash-in{ from{ opacity: 0; } to{ opacity: 1; } }
@keyframes splash-pop{ from{ opacity: 0; transform: translateY(10px) scale(.94); } to{ opacity: 1; transform: none; } }
@keyframes splash-up{ from{ opacity: 0; transform: translateY(6px); } to{ opacity: 1; transform: none; } }
@keyframes splash-rise{ from{ transform: scaleY(0); } to{ transform: scaleY(1); } }
@keyframes splash-light{ from{ opacity: .12; } to{ opacity: 1; } }
@keyframes splash-twinkle{ 0%, 100%{ opacity: 1; } 50%{ opacity: .45; } }
@keyframes splash-dot{ 0%, 100%{ opacity: .25; } 50%{ opacity: 1; } }
@media (prefers-reduced-motion: reduce){
  .splash-card, .splash-load, .st{ animation: none; opacity: 1; transform: none; }
  .sw{ animation: none; opacity: .9; }
  .sd{ animation: none; }
  .splash{ animation-duration: .01s; }
}

/* ==========================================================================
   Committee login: sign in, request (3 steps), forgot / new password
   ========================================================================== */
.gate-card-wide{ max-width: 420px; }
.gate-form{ text-align: left; }
.gate-form-left{ margin-top: 4px; }
.gate-form select{ appearance: auto; }
.gate-field{ display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; text-align: left; }
.gate-field label{ font-size: 12.5px; font-weight: 600; color: var(--text-muted); }
.gate-field .gate-input-wrap{ margin-bottom: 0; }
.gate-field-hint{ margin: 0; font-size: 12px; line-height: 1.45; color: var(--text-muted); }
.gate-form input.gate-code{ text-align: center; font-family: ui-monospace, Consolas, Menlo, monospace; font-size: 24px; font-weight: 700; letter-spacing: .4em; padding-left: .4em; min-height: 52px; }
.gate-form input.gate-code::placeholder{ letter-spacing: .2em; font-weight: 400; }
.gate-form .btn-block{ margin-top: 6px; }
.gate-form .gate-error{ margin: 10px 0 0; text-align: left; }
.gate-actions{ display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 14px; }
.gate-actions .btn{ min-width: 96px; }
.gate-actions .btn:only-child{ margin-left: auto; }
.gate-card .btn{ transition: opacity .25s ease; }
.gate-card .btn:disabled{ opacity: .55; cursor: not-allowed; }
/* A button that is waiting (for example the resend countdown) must not react to a touch or a hover. */
.gate-card .btn:disabled{ pointer-events: none; }
#resendBtn{ margin-top: 10px; }

.gate-divider{ display: flex; align-items: center; gap: 10px; margin: 18px 0 12px; color: var(--text-muted); font-size: 12.5px; }
.gate-divider::before, .gate-divider::after{ content: ""; flex: 1; height: 1px; background: var(--border); }

.gate-steps{ display: flex; gap: 6px; list-style: none; margin: 4px 0 6px; padding: 0; }
.gate-steps li{ flex: 1; height: 4px; border-radius: 2px; background: var(--border); }
.gate-steps li.is-done{ background: var(--green-mid); }
.gate-steps li.is-now{ background: var(--green-deep); }
.gate-step-label{ margin: 0 0 14px; font-size: 12px; color: var(--text-muted); text-align: left; }

.gate-check{ display: flex; align-items: flex-start; gap: 9px; margin: 4px 0 2px; font-size: 13px; color: var(--text); text-align: left; cursor: pointer; }
.gate-form .gate-check input[type="checkbox"]{ width: 18px; height: 18px; padding: 0; margin: 1px 0 0; flex-shrink: 0; accent-color: var(--green-deep); }

.gate-notice{ text-align: left; font-size: 13px; line-height: 1.5; border-radius: var(--radius-sm); padding: 10px 12px; margin: 0 0 14px; border: 1px solid var(--border); }
.gate-notice-ok{ background: var(--tint-green); border-color: #C5DDC0; color: var(--text); }
.gate-notice-warn{ background: var(--tint-amber); border-color: #EBCDA6; color: var(--text); }
.gate-form .gate-notice{ margin: -4px 0 12px; }
:root[data-theme="dark"] .gate-notice-ok{ border-color: #2F5A3B; }
:root[data-theme="dark"] .gate-notice-warn{ border-color: #6B5428; }

/* Profile: one row at the bottom of the sidebar, one menu above it (name, email, appearance, password, home, sign out) */
.profile{ position: relative; }
.profile-btn{
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 52px; padding: 8px 10px;
  border: 1px solid var(--side-border); border-radius: 12px; background: transparent; color: var(--side-text);
  text-align: left; cursor: pointer; font: inherit;
}
.profile-btn:hover, .profile-btn[aria-expanded="true"]{ background: var(--side-hover); }
.profile-btn:focus-visible{ outline: 2px solid var(--lime); outline-offset: 2px; }
.profile-btn[hidden]{ display: none; }
.profile-avatar{
  flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px;
  border-radius: 50%; background: var(--lime); color: #17301d; font-size: 13px; font-weight: 700; letter-spacing: .02em;
}
.profile-text{ flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.profile-name{ display: block; font-size: 13.5px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-meta{ display: block; font-size: 12px; color: var(--side-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-chev{ flex: 0 0 auto; width: 16px; height: 16px; color: var(--side-muted); transition: transform .15s ease; }
.profile-btn[aria-expanded="true"] .profile-chev{ transform: rotate(180deg); }
.profile-menu{
  position: absolute; left: 0; right: 0; bottom: calc(100% + 8px); z-index: 70;
  max-height: calc(100vh - 100px); overflow-y: auto; padding: 6px;
  background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: 0 12px 32px rgba(0,0,0,.28);
}
.profile-menu[hidden]{ display: none; }
.profile-head{ display: flex; flex-direction: column; gap: 2px; padding: 8px 10px 10px; border-bottom: 1px solid var(--border); margin-bottom: 6px; min-width: 0; }
.profile-head .profile-name{ color: var(--text); }
.profile-email{ display: block; font-size: 12px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-sec{ display: flex; flex-direction: column; gap: 6px; padding: 6px 10px 10px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.profile-label{ font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); }
.profile-item{
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 8px 10px;
  border: none; border-radius: 10px; background: transparent; color: var(--text);
  font: inherit; font-size: 14px; font-weight: 600; text-align: left; text-decoration: none; cursor: pointer;
}
.profile-item .icon{ width: 18px; height: 18px; color: var(--text-muted); flex: 0 0 auto; }
.profile-item:hover{ background: var(--surface-alt); }
.profile-item:focus-visible{ outline: 2px solid var(--green-deep); outline-offset: -2px; }
.profile-item-danger, .profile-item-danger .icon{ color: #B3261E; }
:root[data-theme="dark"] .profile-item-danger, :root[data-theme="dark"] .profile-item-danger .icon{ color: #F2837B; }
.profile-menu .theme-switch.is-labelled{ display: flex; border-radius: 12px; }
.profile-menu .theme-switch.is-labelled button{ flex: 1; width: auto; height: 38px; gap: 6px; border-radius: 9px; font: inherit; font-size: 13px; font-weight: 600; }
.profile-menu .theme-switch.is-labelled .icon{ width: 15px; height: 15px; }
.sidebar-footer{ padding: 12px; }
/* Consent summary shown where consent is asked (sign up and first sign in) */
.gate-consent{ text-align: left; margin: 4px 0 12px; padding: 10px 12px; background: var(--surface-alt); border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 13px; line-height: 1.5; }
.gate-consent p{ margin: 0 0 4px; }
.gate-consent ul{ margin: 0 0 6px; padding-left: 18px; }
.gate-consent li{ margin-bottom: 2px; }
/* ---------- Flat cards: the same look for the Resident Directory card and the Vehicle flat card ---------- */
.fc-hero{ display: flex; align-items: center; gap: 14px; padding-bottom: 14px; margin-bottom: 4px; border-bottom: 1px solid var(--border); }
.fc-hero .fc-title{ flex: 1; min-width: 0; }
.fc-hero h2{ margin: 0; font-size: 20px; line-height: 1.2; color: var(--navy-text); }
.fc-hero .detail-subtitle{ margin: 4px 0 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 13px; }
.fc-flat{ flex: 0 0 auto; min-width: 54px; height: 54px; padding: 0 10px; display: inline-flex; align-items: center; justify-content: center; border-radius: 14px; background: var(--tint-green-strong); color: var(--green-text); font-size: 19px; font-weight: 800; letter-spacing: -.01em; }
.fc-person{ display: flex; align-items: center; gap: 12px; }
.fc-who{ min-width: 0; flex: 1; }
.fc-av{ flex: 0 0 auto; width: 42px; height: 42px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--tint-green-strong); color: var(--green-text); font-size: 14px; font-weight: 700; }
.fc-av-t{ background: var(--tint-blue); color: var(--blue-text); }
.fc-role{ display: inline-block; padding: 1px 9px; margin-right: 6px; border-radius: 999px; background: var(--tint-green-strong); color: var(--green-text); font-size: 11.5px; font-weight: 700; letter-spacing: .02em; }
.fc-role-t{ background: var(--tint-blue); color: var(--blue-text); }
.fc-person .fc-name{ font-size: 16.5px; }
.fc-person .fc-sub{ margin-top: 3px; }
.fc-rows{ margin-top: 12px; padding: 4px 12px; background: var(--surface-alt); border-radius: 12px; }
.fc-row{ border-top: 1px solid var(--border); }
.fc-row:first-child{ border-top: 0; }
.fc-consent{ margin-top: 12px; padding: 10px 12px; border-radius: 12px; font-size: 13px; line-height: 1.45; }
.fc-consent.is-ok{ background: var(--tint-green); color: var(--green-text); }
.fc-consent.is-missing{ background: var(--tint-amber); color: var(--text); }
.detail-vehicle-card{ border-radius: 14px; }
.detail-vehicle-card > .fc-person{ margin-bottom: 8px; }
.fc-foot{ margin-top: 10px; }
/* QA fixes: long buttons wrap instead of pushing the page sideways, text links get a proper tap height */
[data-terms-notice]{ max-width: 100%; white-space: normal; text-align: left; height: auto; }
.content .text-link-btn{ min-height: 32px; display: inline-flex; align-items: center; }
.ev-fold{ display: inline-flex; align-items: center; min-height: 36px; margin: 14px 0 4px; padding: 6px 14px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--blue-text); font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; }
.ev-fold:hover{ border-color: var(--blue-text); }
.ev-fold:focus-visible{ outline: 2px solid var(--blue-text); outline-offset: 2px; }
/* Tooltips (js/core/tips.js) */
.ghp-tip{ position: fixed; z-index: 3000; max-width: min(280px, calc(100vw - 16px)); padding: 7px 11px; border-radius: 8px; background: var(--navy-text, #1c2a22); color: var(--surface, #fff); font-size: 12.5px; font-weight: 600; line-height: 1.4; pointer-events: none; box-shadow: var(--shadow-md); overflow-wrap: anywhere; animation: ghp-tip-in .12s ease-out; }
.ghp-tip[hidden]{ display: none; }
.ghp-tip::after{ content: ""; position: absolute; left: var(--tip-x, 50%); bottom: -5px; width: 10px; height: 10px; margin-left: -5px; background: inherit; transform: rotate(45deg); border-radius: 2px; }
.ghp-tip.is-below::after{ bottom: auto; top: -5px; }
:root[data-theme="dark"] .ghp-tip{ background: #E8EEF3; color: #0E1218; }
@keyframes ghp-tip-in{ from{ opacity: 0; transform: translateY(3px); } to{ opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce){ .ghp-tip{ animation: none; } }
/* ---------- Home: the information below the two cards. One message per tile, alternating light and dark, pill buttons, very little text
   (the pattern of apple.com: a large headline, one line, two buttons). Details live on the Residents and Committee pages. ---------- */
.home-info{ margin-top: 0; }
.tl{ padding: 80px 20px; text-align: center; background: var(--surface-alt); color: var(--text); }
.tl-dark{ background: #0f2b1f; color: #f3f7f4; }
.tl[hidden]{ display: none; }
.tl-white{ background: var(--bg); }
.tl-in{ max-width: 980px; margin: 0 auto; }
.tl h2{ margin: 0; font-size: clamp(34px, 6vw, 64px); line-height: 1.05; letter-spacing: -.035em; font-weight: 700; color: var(--navy-text); }
.tl-dark h2{ color: #fff; }
.tl-sub{ margin: 16px auto 0; max-width: 640px; font-size: clamp(17px, 2vw, 22px); line-height: 1.45; color: var(--text-muted); }
.tl-dark .tl-sub{ color: rgba(243,247,244,.8); }
.tl-btns{ display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 28px; }
.pill-btn{ display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 24px; border-radius: 980px; font-size: 16.5px; font-weight: 500; text-decoration: none; border: 1px solid transparent; transition: background .2s, transform .2s, border-color .2s; }
.pill-btn:hover{ transform: translateY(-1px); }
.pill-btn:focus-visible{ outline: 2px solid var(--blue-text); outline-offset: 3px; }
.pill-fill{ background: #0b5cad; color: #fff; }
.pill-fill:hover{ background: #0a4f94; }
.pill-line{ border-color: #0b5cad; color: #0b5cad; background: transparent; }
.pill-line:hover{ background: rgba(11,92,173,.08); }
.tl-dark .pill-fill{ background: #fff; color: #0f2b1f; }
.tl-dark .pill-fill:hover{ background: #e6efe9; }
.tl-dark .pill-line{ border-color: rgba(255,255,255,.7); color: #fff; }
.tl-dark .pill-line:hover{ background: rgba(255,255,255,.1); }
html[data-theme="dark"] .pill-line{ border-color: #6fb3ee; color: #6fb3ee; }
html[data-theme="dark"] .pill-fill{ background: #2f81d4; }
.tl-cap{ list-style: none; margin: 52px auto 0; padding: 0; display: grid; grid-template-columns: 1fr; gap: 28px; text-align: center; max-width: 900px; }
.tl-cap .icon{ width: 28px; height: 28px; color: var(--blue-text); margin-bottom: 10px; }
.tl-dark .tl-cap .icon{ color: #8fd1a9; }
.tl-cap b{ display: block; font-size: 17px; font-weight: 600; }
.tl-cap span{ display: block; margin-top: 4px; font-size: 14.5px; line-height: 1.5; color: var(--text-muted); }
.tl-dark .tl-cap span{ color: rgba(243,247,244,.72); }
.tl-mods{ margin: 36px 0 0; font-size: 14px; letter-spacing: .02em; color: var(--text-muted); }
.cap-ic{ display: inline-flex; align-items: center; justify-content: center; width: 52px; height: 52px; margin: 0 auto 14px; border-radius: 50%; background: rgba(11,92,173,.10); color: var(--blue-text); }
.cap-ic .icon{ width: 25px; height: 25px; margin: 0; }
.tl-dark .cap-ic{ background: rgba(255,255,255,.12); color: #bfe8cf; }
.tl-dark .tl-cap .icon, .tl-dark .cap-ic .icon{ color: #bfe8cf; }
.cap-pin{ margin-bottom: 18px; }
.mods{ list-style: none; margin: 40px 0 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.mods li{ display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: 980px; background: var(--surface); border: 1px solid var(--border); font-size: 14.5px; font-weight: 500; color: var(--text); }
.mods .icon{ width: 18px; height: 18px; color: var(--blue-text); }
.tl-dark{ position: relative; overflow: hidden; }
.tl-dark::before{ content: ""; position: absolute; left: 50%; top: -140px; width: 720px; height: 420px; transform: translateX(-50%); background: radial-gradient(closest-side, rgba(110,200,150,.22), transparent); pointer-events: none; }
.tl-dark .tl-in{ position: relative; }
.tl-cap li{ transition: transform .25s; }
@media (hover: hover){ .tl-cap li:hover{ transform: translateY(-3px); } }
@media (prefers-reduced-motion: reduce){ .tl-cap li{ transition: none; } .tl-cap li:hover{ transform: none; } }
.faq{ margin: 40px auto 0; max-width: 780px; border-top: 1px solid var(--border); text-align: left; }
.faq details{ border-bottom: 1px solid var(--border); padding: 20px 0; }
.faq summary{ cursor: pointer; list-style: none; display: flex; justify-content: space-between; gap: 16px; font-weight: 600; font-size: 18px; color: var(--text); }
.faq summary::-webkit-details-marker{ display: none; }
.faq summary::after{ content: "+"; font-size: 26px; line-height: 1; color: var(--blue-text); transition: transform .2s; }
.faq details[open] summary::after{ transform: rotate(45deg); }
.faq summary:focus-visible{ outline: 2px solid var(--blue-text); outline-offset: 3px; border-radius: 6px; }
.faq p{ margin: 12px 0 0; font-size: 16px; line-height: 1.65; color: var(--text-muted); }
.faq a{ color: var(--blue-text); }
.sub-about{ margin: 36px 0 0; max-width: 780px; }
.sub-about h2{ margin: 0 0 6px; font-size: 14px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); }
.sub-about dl{ margin: 0; }
.sub-about dt{ padding-top: 14px; border-top: 1px solid var(--border); font-size: 16px; font-weight: 600; color: var(--text); }
.sub-about dd{ margin: 2px 0 14px; font-size: 14.5px; line-height: 1.6; color: var(--text-muted); }
.rv{ opacity: 1; }
.rv.in{ opacity: 1; transform: none; }
@media (min-width: 760px){
  .tl{ padding: 112px 28px; }
  .tl-cap{ grid-template-columns: repeat(3, 1fr); gap: 36px; }
  .tl-cap.four{ grid-template-columns: repeat(4, 1fr); max-width: 980px; }
}
@media (prefers-reduced-motion: reduce){ .rv{ opacity: 1; transform: none; transition: none; } .pill-btn, .faq summary::after{ transition: none; } .pill-btn:hover{ transform: none; } }
/* Home entrances (two cards that lead to the resident and committee landing pages) and those landing pages */
.home-entries{ display: grid; grid-template-columns: 1fr; gap: 18px; }
.entry{ display: flex; flex-direction: column; gap: 12px; padding: 24px; background: var(--surface); border: 1px solid var(--border); border-radius: 20px; box-shadow: var(--shadow-md); text-decoration: none; color: var(--text); transition: transform .18s ease, box-shadow .18s ease; }
.entry:hover{ transform: translateY(-3px); box-shadow: var(--shadow-lg, 0 18px 40px -16px rgba(14,30,22,.35)); }
.entry:focus-visible{ outline: 2px solid var(--blue-text); outline-offset: 3px; }
.entry-residents{ background: linear-gradient(180deg, color-mix(in srgb, var(--blue) 9%, transparent), transparent 170px), var(--surface); }
.entry-committee{ background: linear-gradient(180deg, color-mix(in srgb, var(--green-deep) 10%, transparent), transparent 170px), var(--surface); }
.entry-residents .space-icon{ background: linear-gradient(135deg, #1D6FA8, #3FA9D6); }
.entry-committee .space-icon{ background: linear-gradient(135deg, #2E6B3E, #8CB93C); }
.entry p{ margin: 0; font-size: 15px; line-height: 1.5; color: var(--text-muted); }
.entry-go{ display: inline-flex; align-items: center; gap: 8px; margin-top: 4px; font-weight: 700; font-size: 15px; }
.entry-residents .entry-go{ color: var(--blue-text); }.entry-committee .entry-go{ color: var(--green-text); }
.entry-go .icon{ width: 18px; height: 18px; transition: transform .18s; }
.entry:hover .entry-go .icon{ transform: translateX(3px); }
.sub-wrap{ max-width: 1100px; margin: 0 auto; padding: 24px 16px 48px; }
.sub-back{ display: inline-flex; align-items: center; gap: 6px; margin-bottom: 18px; font-size: 14.5px; font-weight: 600; color: var(--blue-text); text-decoration: none; min-height: 36px; }
.sub-back .icon{ width: 18px; height: 18px; }
.sub-back:hover{ text-decoration: underline; }
.sub-head{ display: flex; flex-wrap: wrap; align-items: center; gap: 16px; margin-bottom: 22px; }
.sub-head > div{ flex: 1; min-width: 220px; }
.sub-head h1{ margin: 0 0 2px; font-size: 28px; line-height: 1.15; color: var(--navy-text); }
.sub-head p{ margin: 0; font-size: 15.5px; color: var(--text-muted); }
.sub-head .space-icon{ width: 56px; height: 56px; border-radius: 16px; }
.sub-res{ background: linear-gradient(135deg, #1D6FA8, #3FA9D6); }.sub-com{ background: linear-gradient(135deg, #2E6B3E, #8CB93C); }
.sub-login{ width: 100%; }
.sub-note{ margin: 20px 0 0; font-size: 14px; color: var(--text-muted); }
.uses{ list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.uses li{ padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; }
.uses b{ display: block; font-size: 15px; color: var(--text); }.uses span{ display: block; font-size: 14px; line-height: 1.5; color: var(--text-muted); margin-top: 2px; }
@media (min-width: 760px){
  .home-entries{ grid-template-columns: 1fr 1fr; gap: 22px; }
  .sub-login{ width: auto; }
  .sub-wrap{ padding: 32px 24px 64px; }
  .sub-head h1{ font-size: 32px; }
}
@media (prefers-reduced-motion: reduce){ .entry, .entry-go .icon{ transition: none; } .entry:hover{ transform: none; } }
.nav-empty{ margin: 12px; font-size: 13px; line-height: 1.5; color: var(--text-muted); }
/* Small popups (change password) stay narrow on wide screens too. */
.modal-overlay .modal.modal-narrow[role="dialog"]{ max-width: 440px; }
.modal-overlay .modal.modal-narrow.modal-mid[role="dialog"]{ max-width: 560px; }

/* ==========================================================================
   Admin: requests, accounts, roles & access, activity
   ========================================================================== */
.adm{ max-width: 1040px; }
.adm-tabs{ display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--border); margin-bottom: 18px; scrollbar-width: none; }
.adm-tabs::-webkit-scrollbar{ display: none; }
.adm-tab{ background: none; border: 0; border-bottom: 3px solid transparent; padding: 10px 14px; font-size: 14px; font-weight: 600; color: var(--text-muted); white-space: nowrap; cursor: pointer; margin-bottom: -1px; }
.adm-tab:hover{ color: var(--text); }
.adm-tab.is-on{ color: var(--navy-text); border-bottom-color: var(--green-mid); }
.adm-pill{ display: inline-block; min-width: 20px; padding: 1px 6px; border-radius: 10px; background: var(--red); color: #fff; font-size: 11.5px; text-align: center; margin-left: 4px; }

.adm-h{ margin: 24px 0 4px; font-size: 15px; color: var(--navy-text); }
.adm-sub{ margin: 0 0 10px; font-size: 12.5px; }
.adm-muted{ color: var(--text-muted); }
.adm-text{ margin: 0 0 12px; font-size: 14px; line-height: 1.55; }
.adm-empty{ padding: 28px 12px; text-align: center; color: var(--text-muted); font-size: 14px; border: 1px dashed var(--border); border-radius: var(--radius-sm); }
.adm-grow{ flex: 1 1 260px; margin: 0; font-size: 13px; line-height: 1.5; }

.adm-tiles{ display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.adm-tile{ display: flex; flex-direction: column; gap: 2px; text-align: left; padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md, 12px); cursor: pointer; font: inherit; color: var(--text); }
.adm-tile:hover:not(.adm-tile-static){ border-color: var(--green-mid); }
.adm-tile-static{ cursor: default; }
.adm-tile-hot{ background: var(--tint-amber); border-color: #EBCDA6; }
.adm-num{ font-size: 26px; font-weight: 700; color: var(--navy-text); line-height: 1.1; }
.adm-lbl{ font-size: 12.5px; color: var(--text-muted); }

.adm-grid{ display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
.adm-bld{ display: flex; flex-direction: column; gap: 2px; align-items: flex-start; padding: 10px 12px; border: 1px dashed var(--border); border-radius: var(--radius-sm); background: transparent; color: var(--text-muted); cursor: pointer; font: inherit; text-align: left; }
.adm-bld strong{ font-size: 16px; color: var(--text); }
.adm-bld span{ font-size: 12px; }
.adm-bld:hover{ border-color: var(--green-mid); }
.adm-bld.is-on{ border-style: solid; background: var(--tint-green); border-color: #C5DDC0; color: var(--green-text, var(--text)); }
.adm-bld.is-off{ border-style: solid; background: var(--surface-alt); }
.adm-bld.is-wait{ border-style: solid; background: var(--tint-amber); border-color: #EBCDA6; color: var(--amber-text, var(--text)); }
:root[data-theme="dark"] .adm-bld.is-on{ border-color: #2F5A3B; }
:root[data-theme="dark"] .adm-bld.is-wait, :root[data-theme="dark"] .adm-tile-hot{ border-color: #6B5428; }

.adm-recent{ list-style: none; margin: 8px 0 0; padding: 0; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.adm-recent li{ display: flex; justify-content: space-between; gap: 12px; padding: 9px 12px; font-size: 13px; }
.adm-recent li + li{ border-top: 1px solid var(--border); }
.adm-recent time{ color: var(--text-muted); white-space: nowrap; }

.adm-chips{ display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.adm-chip{ padding: 6px 12px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); color: var(--text); font-size: 13px; font-weight: 600; cursor: pointer; }
.adm-chip.is-on{ background: var(--green-deep); border-color: var(--green-deep); color: #fff; }

.adm-card{ background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md, 12px); padding: 14px 16px; margin-bottom: 12px; }
.adm-card-top{ display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.adm-card-actions{ display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.adm-inline{ display: flex; gap: 8px; align-items: center; }
.adm-dl{ display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px 16px; margin: 0; }
.adm-dl dt{ font-size: 12px; color: var(--text-muted); }
.adm-dl dd{ margin: 0; font-size: 13.5px; overflow-wrap: anywhere; }

.adm-badge{ display: inline-block; padding: 2px 9px; border-radius: 10px; font-size: 12px; font-weight: 600; background: var(--surface-alt); color: var(--text-muted); }
.adm-b-ok{ background: var(--tint-green-strong); color: var(--green-text, #2E6B3E); }
.adm-b-warn{ background: var(--tint-amber); color: var(--amber-text, #8A5A12); }
.adm-b-off{ background: var(--tint-red); color: var(--red-text); }

.adm-toolbar{ display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.adm-toolbar input[type="search"]{ flex: 1 1 220px; min-width: 0; }
.adm-toolbar input, .adm-toolbar select, .adm-dlg-body input:not([type="checkbox"]):not([type="radio"]), .adm-dlg-body select, .adm-dlg-body textarea, .adm-matrix select{
  padding: 9px 11px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg); color: var(--text); font: inherit; font-size: 14px; width: 100%;
}
.adm-toolbar select{ width: auto; }
.adm-toolbar input:focus, .adm-toolbar select:focus, .adm-dlg-body input:focus, .adm-dlg-body select:focus, .adm-dlg-body textarea:focus, .adm-matrix select:focus{ outline: none; border-color: var(--green-mid); box-shadow: 0 0 0 3px rgba(78,139,78,.18); }

.adm-tablewrap{ overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.adm-card .adm-tablewrap{ border: 0; }
.adm-table{ width: 100%; border-collapse: collapse; font-size: 13.5px; }
.adm-table th{ text-align: left; font-size: 12px; font-weight: 600; color: var(--text-muted); padding: 9px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.adm-table td{ padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.adm-table tr:last-child td{ border-bottom: 0; }
.adm-sub-line{ display: block; font-size: 12px; color: var(--text-muted); overflow-wrap: anywhere; }
.adm-c{ text-align: center; }
.adm-matrix td:first-child{ font-weight: 600; white-space: nowrap; }
.adm-matrix select{ padding: 6px 8px; font-size: 13px; }
.adm-actions{ text-align: right; width: 1%; white-space: nowrap; }

.adm-menu{ position: relative; display: inline-block; }
.adm-menu summary{ list-style: none; cursor: pointer; padding: 4px 12px; font-size: 20px; line-height: 1.2; }
.adm-menu summary::-webkit-details-marker{ display: none; }
.adm-menu-list{ position: absolute; right: 0; top: 100%; z-index: 200; min-width: 190px; max-height: calc(100vh - 16px); overflow-y: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-md); padding: 4px; text-align: left; }
.adm-menu-list button{ display: block; width: 100%; text-align: left; background: none; border: 0; padding: 9px 12px; border-radius: 6px; font: inherit; font-size: 13.5px; color: var(--text); cursor: pointer; }
.adm-menu-list button:hover{ background: var(--surface-alt); }
.adm-menu-list .is-danger{ color: var(--red); }

.adm-seg{ display: flex; gap: 6px; margin-bottom: 14px; }
.adm-seg label{ flex: 1; display: flex; align-items: center; gap: 8px; padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 13.5px; cursor: pointer; }
.adm-seg input{ accent-color: var(--green-deep); }
.adm-details{ margin: 4px 0 12px; font-size: 13.5px; }
.adm-details summary{ cursor: pointer; color: var(--blue-text); font-weight: 600; margin-bottom: 8px; }
.adm-checks{ display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 6px; }
.adm-check{ display: flex; align-items: center; gap: 6px; font-size: 13.5px; cursor: pointer; }
.adm-check input{ width: 16px; height: 16px; accent-color: var(--green-deep); }
.adm-send{ margin-top: 6px; }
.adm-dlg-body .gate-field{ margin-bottom: 12px; }
.adm-dlg-err{ text-align: left; margin: 0 0 10px; }
.adm-dlg-actions{ display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.adm-pw{ user-select: all; }

@media (max-width: 639px){
  .adm-table thead{ display: none; }
  .adm-table:not(.adm-matrix) tr{ display: block; padding: 10px 12px; border-bottom: 1px solid var(--border); position: relative; }
  .adm-table:not(.adm-matrix) td{ display: block; padding: 2px 0; border: 0; }
  .adm-table:not(.adm-matrix) td.adm-actions{ position: absolute; top: 6px; right: 6px; width: auto; }
  .adm-seg{ flex-direction: column; }
}
@media (max-width: 639px){
  .adm-matrix tr{ display: grid; grid-template-columns: 1fr 1fr auto; gap: 6px 8px; align-items: center; padding: 10px 4px; border-bottom: 1px solid var(--border); }
  .adm-matrix tr:last-child{ border-bottom: 0; }
  .adm-matrix td{ display: block; padding: 0; border: 0; }
  .adm-matrix td:first-child{ grid-column: 1 / -1; }
  .adm-matrix td.adm-c::after{ content: " Export"; font-size: 12px; color: var(--text-muted); }
  .adm-matrix td.adm-c{ display: flex; align-items: center; gap: 4px; }
}
.adm-note{ margin: 12px 0 0; font-size: 12.5px; line-height: 1.5; }

/* ==========================================================================
   1.5.0 Resident Directory (js/modules/directory/directory.js)
   Uses the same tokens, cards, eye and edit icons as Vehicle Management.
   ========================================================================== */
.dir-top{ display: flex; align-items: center; margin-bottom: 14px; }
.dir-top-col{ flex-direction: column; align-items: flex-start; gap: 6px; }
.dir-top-col .registry-building-title{ margin: 0; }
/* A society with no flats yet: dashed like Vehicle Management, but still clickable so the platform admin can add its first flat. */
.building-card-open{ cursor: pointer; }
.building-card-open:hover, .building-card-open:focus-visible{ border-color: var(--green-mid); }
.dir-society{ display: inline-flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 600; color: var(--text-muted); }
.dir-society select{ padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font-size: 14px; font-weight: 600; }

/* Search, filters and actions sit on one line on desktop and stack on phones. */
.dir-bar{ display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 8px; }
.dir-search{ flex: 1 1 280px; }
.dir-search input[type="search"]{ width: 100%; padding: 10px 12px 10px 36px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font-size: 14.5px; }
.dir-search input[type="search"]:focus{ outline: none; border-color: var(--green-mid); box-shadow: 0 0 0 3px rgba(78,139,78,0.15); }
.dir-filters{ display: flex; flex-wrap: wrap; gap: 10px; flex: 1 1 auto; min-width: 0; }
.dir-filters select{ padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font-size: 14px; min-width: 150px; }
.dir-actions{ display: flex; gap: 10px; margin-left: auto; }
.dir-actions .btn{ white-space: nowrap; }
.dir-filter-btn{ display: none; }
.dir-count{ margin: 0 0 10px; min-height: 18px; font-size: 12.5px; color: var(--text-muted); }

/* The list: one clean row per flat, nothing wraps. */
.dir-list{ background: var(--surface); border-radius: var(--radius-md); box-shadow: var(--shadow-sm); overflow: hidden; }
.dir-head, .dir-row{ display: grid; grid-template-columns: 84px minmax(0, 1.3fr) minmax(0, 1.3fr) 140px 20px; column-gap: 18px; align-items: center; padding-left: 22px; padding-right: 22px; }
.dir-head{ min-height: 42px; background: var(--surface-alt); border-bottom: 1px solid var(--border); font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--text-muted); }
.dir-row{ width: 100%; min-height: 68px; padding-top: 12px; padding-bottom: 12px; border: 0; border-bottom: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.dir-row:last-child{ border-bottom: 0; }
.dir-row:hover{ background: var(--hover-row); }
.dir-row:active{ background: var(--surface-alt); }
.dir-row:focus-visible{ outline: 2px solid var(--green-mid); outline-offset: -2px; }
.dir-c{ display: block; min-width: 0; }
.dir-cell-label{ display: none; }
.dir-flat{ display: inline-flex; align-items: center; justify-content: center; min-width: 52px; height: 38px; padding: 0 12px; border-radius: 10px; background: var(--surface-alt); border: 1px solid var(--border); color: var(--navy-text); font-weight: 700; font-size: 15px; }
.dir-name{ display: block; font-size: 14.5px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dir-sub{ display: block; margin-top: 2px; font-size: 12.5px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dir-none{ color: var(--text-muted); }
.dir-pill{ display: inline-flex; align-items: center; gap: 7px; padding: 4px 12px 4px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; white-space: nowrap; vertical-align: middle; }
.dir-pill::before{ content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.dir-pill-self{ background: var(--tint-green-strong); color: var(--green-text); }
.dir-pill-rented{ background: var(--tint-blue); color: var(--blue-text); }
.dir-pill-vacant{ background: var(--surface-alt); color: var(--text-muted); border: 1px solid var(--border); }
.dir-end{ font-weight: 700; margin-left: 4px; }
.dir-end-soon{ color: var(--amber-text); }
.dir-end-over{ color: var(--red-text); }
.dir-chev{ width: 16px; height: 16px; color: var(--text-muted); justify-self: end; }
.dir-nomatch{ margin: 0; padding: 28px 20px; text-align: center; color: var(--text-muted); }

.dir-empty{ background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius-md); padding: 38px 22px; text-align: center; }
.dir-empty-icon{ width: 44px; height: 44px; color: var(--green-mid); }
.dir-empty h3{ margin: 10px 0 6px; font-size: 17px; color: var(--navy-text); }
.dir-empty p{ margin: 0 auto 18px; max-width: 460px; font-size: 14px; line-height: 1.55; color: var(--text-muted); }
.dir-empty-actions{ display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* Flat card (reuses the Vehicle Management detail card classes) */
.dir-card-list{ max-height: none; }
.dir-ptitle{ margin: 6px 0 0; font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--text-muted); }
.dir-ptitle:first-child{ margin-top: 0; }
.dir-card-list .detail-vehicle-head + .detail-vehicle-head{ margin-top: 6px; }
.dir-lines{ margin-top: 8px; }
.dir-lines .detail-vehicle-extra{ display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.dir-lines .detail-vehicle-extra:last-child{ margin-bottom: 0; }
.dir-card-list .detail-vehicle-head{ justify-content: space-between; }
.dir-masked span{ overflow-wrap: anywhere; }

/* Add / edit form */
.dir-form .form-field.full{ grid-column: 1 / -1; }
.dir-sec{ display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 22px 0 12px; padding-top: 16px; border-top: 1px solid var(--border); }
.dir-sec-first{ margin-top: 4px; padding-top: 0; border-top: 0; }
.dir-sec h3{ margin: 0; font-size: 14px; color: var(--navy-text); }
.dir-sec span{ font-size: 12px; color: var(--text-muted); text-align: right; }
.dir-opt{ font-weight: 400; color: var(--text-muted); }
.dir-hint{ margin: 8px 0 0; font-size: 12.5px; color: var(--amber-text); }
.dir-ferr{ font-size: 12px; color: var(--red-text); }
.form-field.has-error input, .form-field.has-error select{ border-color: var(--red); }
.dir-formerr{ margin: 0 0 12px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--tint-red); color: var(--red-text); font-size: 13.5px; }
.dir-form input[type="date"]{ min-height: 42px; width: 100%; box-sizing: border-box; }
.dir-form .form-field input:disabled{ background: var(--surface-alt); color: var(--text-muted); }
.dir-confirm{ margin: 0 0 4px; font-size: 14px; line-height: 1.55; color: var(--text); }

/* CSV import */
/* Resident Directory: society details strip (flats, floors, refuge areas) */
.dir-facts{ display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 14px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); }
.dir-facts.is-unset{ background: var(--tint-amber); border-color: #EBCDA6; }
:root[data-theme="dark"] .dir-facts.is-unset{ border-color: #6B5428; }
.dir-facts-text{ display: flex; flex-direction: column; gap: 2px; min-width: 0; font-size: 13.5px; line-height: 1.5; color: var(--text); }
.dir-facts-title{ font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--text-muted); }
.dir-facts .btn{ flex: 0 0 auto; }
@media (max-width: 520px){ .dir-facts{ flex-direction: column; align-items: stretch; } .dir-facts .btn{ width: 100%; } }
.dir-note{ margin: 0 0 10px; font-size: 13.5px; line-height: 1.55; color: var(--text-muted); }
.dir-link{ background: none; border: 0; padding: 0; font: inherit; font-weight: 600; color: var(--blue-text); text-decoration: underline; cursor: pointer; }
.dir-drop{ display: flex; align-items: center; justify-content: center; margin: 12px 0; padding: 22px 14px; border: 2px dashed var(--border); border-radius: var(--radius-md); background: var(--surface-alt); color: var(--text); font-weight: 600; cursor: pointer; text-align: center; overflow-wrap: anywhere; }
.dir-drop:hover{ border-color: var(--green-mid); }
.dir-drop input{ position: absolute; width: 1px; height: 1px; opacity: 0; }
.dir-drop:focus-within{ border-color: var(--green-mid); box-shadow: 0 0 0 3px rgba(78,139,78,0.15); }
.dir-ok{ margin: 0 0 8px; font-size: 14px; color: var(--green-text); }
.dir-issues{ max-height: 170px; overflow: auto; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--tint-amber); color: var(--amber-text); font-size: 13px; }
.dir-issues p{ margin: 0 0 4px; }
.dir-issues ul{ margin: 0; padding-left: 18px; }

@media (max-width: 959px){
  .dir-head, .dir-row{ grid-template-columns: 76px minmax(0, 1.2fr) minmax(0, 1.2fr) 128px 16px; column-gap: 14px; padding-left: 16px; padding-right: 16px; }
  .dir-filters select{ min-width: 130px; }
}

/* Phones: each flat becomes its own card. */
@media (max-width: 719px){
  .dir-bar{ gap: 8px; }
  .dir-search{ flex: 1 1 100%; }
  .dir-filter-btn{ display: inline-flex; flex: 1 1 100%; justify-content: center; }
  .dir-filters{ display: none; flex: 1 1 100%; flex-direction: column; }
  .dir-filters.is-open{ display: flex; }
  .dir-filters select{ width: 100%; min-width: 0; }
  .dir-actions{ flex: 1 1 100%; margin-left: 0; }
  .dir-actions .btn{ flex: 1 1 auto; justify-content: center; }
  .dir-actions .menu-wrap{ flex: 1 1 auto; }
  .dir-actions .menu-wrap > .btn{ width: 100%; }
  .dir-list{ background: transparent; box-shadow: none; border-radius: 0; overflow: visible; }
  .dir-head{ display: none; }
  .dir-row{
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas: "flat status" "owner owner" "tenant tenant";
    row-gap: 12px; padding: 14px 16px; margin-bottom: 10px;
    border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-sm);
  }
  .dir-row:last-child{ border-bottom: 1px solid var(--border); }
  .dir-c-flat{ grid-area: flat; }
  .dir-c-status{ grid-area: status; justify-self: end; }
  .dir-c-owner{ grid-area: owner; }
  .dir-c-tenant{ grid-area: tenant; }
  .dir-c-tenant.is-empty{ display: none; }
  .dir-row > .dir-chev{ display: none; }
  .dir-cell-label{ display: block; margin-bottom: 2px; font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--text-muted); }
  .dir-name, .dir-sub{ white-space: normal; overflow: visible; text-overflow: clip; }
  .dir-end{ display: inline-block; }
  .dir-sec span{ display: none; }
}
@media (max-width: 719px){
  .dir .summary-card:last-child:nth-child(odd){ grid-column: 1 / -1; }
}
/* The delete icon stays on the same line as Close and Edit, also on phones. */
.modal-actions .detail-vehicle-delete + .modal-actions-right{ width: auto; flex: 1 1 auto; margin-left: 8px; }
.modal-actions .detail-vehicle-delete{ width: 40px; height: 40px; flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; }
@media (pointer: coarse){
  .dir-form .form-field input, .dir-form .form-field select{ min-height: 44px; font-size: 16px; }
  .dir-filters select, .dir-search input[type="search"]{ min-height: 44px; font-size: 16px; }
}
/* Role based buttons: app.js sets perm-noedit, perm-nodelete and perm-noexport on the page for the role that is signed in. */
.perm-noedit [data-role="addEntryBtn"],
.perm-noedit [data-role="addActivityBtn"],
.perm-noedit [data-role="addExpenseBtn"],
.perm-noedit [data-role="importBtn"],
.perm-noedit [data-role="templateBtn"],
.perm-noedit .detail-vehicle-edit,
.perm-noedit [data-action="add-vehicle"],
.perm-noedit .row-edit-btn{ display: none !important; }
.perm-nodelete .detail-vehicle-delete,
.perm-nodelete [data-action="delete"]{ display: none !important; }
.perm-noexport [data-role="exportCsvBtn"],
.perm-noexport [data-role="exportPdfBtn"],
.perm-noexport [data-role="export"],
.perm-noexport .menu-divider{ display: none !important; }
.detail-vehicle-actions:empty{ display: none; }

/* My Society: what each role can open */
.bm-access{ margin-top: 8px; }
.bm-access-note{ margin: 0 0 12px; font-size: 13.5px; line-height: 1.55; color: var(--text-muted); }
.bm-role{ background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-sm); margin-bottom: 12px; overflow: hidden; }
.bm-role-top{ display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--surface-alt); }
.bm-role-top strong{ color: var(--navy-text); font-size: 15px; }
.bm-role-top .adm-inline{ display: flex; gap: 8px; align-items: center; }
.bm-rows{ display: grid; grid-template-columns: minmax(0, 1fr) 170px 86px; gap: 0; }
.bm-rows > *{ padding: 10px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; }
.bm-rows > .bm-h{ font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--text-muted); background: var(--surface); }
.bm-rows > .bm-m{ font-weight: 600; color: var(--text); }
.bm-rows select{ width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font-size: 14px; }
.bm-rows .bm-x{ justify-content: center; }
.bm-rows .bm-x input{ width: 20px; height: 20px; }
.bm-rows > :nth-last-child(-n+3){ border-bottom: 0; }
.bm-custom{ font-size: 12px; font-weight: 600; color: var(--amber-text); background: var(--tint-amber); padding: 2px 9px; border-radius: 999px; }
@media (max-width: 559px){
  .bm-rows{ grid-template-columns: minmax(0, 1fr) 128px 60px; }
  .bm-rows > *{ padding: 9px 10px; }
  .bm-role-top{ padding: 10px 12px; }
}

/* 1.8.0 Vehicle and Commercial records in the database */
.form-field.full{ grid-column: 1 / -1; }
.imp-result{ margin-top: 10px; }
.imp-ok{ margin: 0 0 10px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--tint-green, var(--surface-alt)); color: var(--green-text); font-size: 13.5px; }
.imp-bad{ margin: 0 0 10px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--tint-red); color: var(--red-text); font-size: 13.5px; }
.imp-bad p{ margin: 0 0 6px; }
.imp-bad ul{ margin: 0; padding-left: 18px; }
.entry-form .form-hint[data-role="dirHint"]{ margin-top: 10px; }
@media (pointer: coarse){
  .entry-form textarea, .entry-form input[type="date"], .entry-form input[type="time"], .entry-form input[type="number"]{ font-size: 16px; }
}

/* 1.9.0 Common Expenses */
.ex-filters{ display: flex; gap: 10px; flex-wrap: wrap; }
.ex-events{ display: flex; flex-direction: column; gap: 10px; }
.ex-event{ display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; text-align: left; width: 100%; padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; font: inherit; color: var(--text); }
.ex-event:hover{ border-color: var(--green-mid); }
.ex-event-main{ display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ex-event-sub{ grid-column: 1; font-size: 13px; color: var(--text-muted); }
.ex-event-amt{ grid-column: 2; grid-row: 1 / span 2; display: flex; flex-direction: column; align-items: flex-end; justify-content: center; gap: 2px; }
.ex-mine{ font-size: 12.5px; color: var(--green-text); }
.ex-modal{ max-width: 760px; }
.ex-none{ margin: 8px 0 18px; padding: 16px 18px; border: 1px dashed var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text-muted); font-size: 14px; line-height: 1.5; }.ex-pick{ max-width: 320px; margin-bottom: 10px; }
.ex-focus{ margin: 0 0 12px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--tint-green); color: var(--green-text); font-size: 14px; }
.ex-table td, .ex-table th{ text-align: left; }
.ex-hl td{ background: var(--tint-green); font-weight: 600; }
.ex-line{ border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; margin-bottom: 8px; }
.ex-line-top{ display: flex; justify-content: space-between; gap: 12px; }
.ex-line-sub, .ex-line-by{ margin-top: 3px; font-size: 12.5px; color: var(--text-muted); }
.ex-line-actions{ display: flex; gap: 8px; margin-top: 8px; }
.ex-checks{ display: flex; flex-wrap: wrap; gap: 8px 14px; }
.ex-check{ display: inline-flex; align-items: center; gap: 6px; font-size: 14px; }
.ex-check small{ color: var(--text-muted); }
.ex-tabs{ display: flex; gap: 8px; margin: 4px 0 12px; flex-wrap: wrap; }
.ex-tabs button{ display: flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 10px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; }
.ex-tabs button small{ font-weight: 400; font-size: 12px; color: var(--text-muted); }
.toolbar-row.ex-filters select[data-role="buildingSel"]{ min-width: min(100%, 290px); }
@media (max-width: 560px){
  .ex-tabs{ display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .ex-tabs button{ min-width: 0; padding: 10px 12px; text-align: left; font-size: 14px; }
  .toolbar-row.ex-filters select{ flex: 1 1 calc(50% - 10px); width: auto; max-width: none; min-width: 0; }
  .toolbar-row.ex-filters select[data-role="buildingSel"]{ flex-basis: 100%; grid-column: 1 / -1; }
}
.ex-tabs button.is-on{ border-color: var(--green-mid); background: var(--tint-green); color: var(--green-text); }
.ex-kind{ display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.ex-kind-opt{ display: flex; align-items: flex-start; gap: 8px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; }
.ex-kind-opt:has(input:checked){ border-color: var(--green-mid); background: var(--tint-green); }
.ex-kind-opt span{ display: flex; flex-direction: column; font-size: 14px; }
.ex-kind-opt small{ color: var(--text-muted); font-size: 12px; }
.ex-trend{ margin-bottom: 14px; }
@media (max-width: 559px){ .ex-kind{ grid-template-columns: 1fr; } }
.ex-warn{ margin: 0 0 12px; padding: 12px 14px; border-radius: var(--radius-sm); border: 1px solid var(--red); background: var(--tint-red); color: var(--red-text); font-size: 14px; line-height: 1.5; }
.ex-warn-what{ margin: 0 0 12px; font-weight: 600; }
.ex-tablewrap{ overflow-x: auto; margin-bottom: 8px; }
.ex-table{ width: 100%; border-collapse: collapse; font-size: 14px; }
.ex-table th, .ex-table td{ padding: 8px 6px; border-bottom: 1px solid var(--border); text-align: left; }
.ex-table th{ font-size: 12px; font-weight: 600; color: var(--text-muted); }
.ex-table input{ width: 90px; max-width: 100%; }
.form-field textarea{ font-family: inherit; }
@media (max-width: 559px){ .ex-event{ grid-template-columns: 1fr; } .ex-event-amt{ grid-column: 1; grid-row: auto; align-items: flex-start; } }
.ex-check.is-off{ opacity: .6; }
.ex-addb{ display: flex; gap: 8px; }
.ex-addb input{ max-width: 140px; }

/* ==========================================================================
   1.9.3 Phone polish (real device check): tabs, activity, folding roles, flat card, eye icon, date fields
   ========================================================================== */
/* Recent activity on the dashboard wraps instead of running out of the card. */
.adm-recent li{ flex-wrap: wrap; align-items: baseline; }
.adm-recent li span{ flex: 1 1 180px; min-width: 0; overflow-wrap: anywhere; }
.adm-recent time{ flex: 0 0 auto; font-size: 12px; }
@media (max-width: 480px){ .adm-recent li{ flex-direction: column; gap: 2px; } }

/* Tables turn into cards on phones; every value then carries its own small label. */
.adm-table td{ overflow-wrap: anywhere; }
@media (max-width: 639px){
  .adm-table:not(.adm-matrix) td[data-label]{ display: flex; flex-wrap: wrap; gap: 2px 10px; align-items: baseline; padding: 3px 0; }
  .adm-table:not(.adm-matrix) td[data-label]::before{ content: attr(data-label); flex: 0 0 68px; font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-muted); }
  .adm-table:not(.adm-matrix) tr{ padding: 12px 14px; }
  .adm-table:not(.adm-matrix) td:first-child{ padding-right: 44px; }
}

/* Role cards fold away; only the one being worked on is open. */
details.adm-fold{ border: 1px solid var(--border); border-radius: var(--radius-md, 12px); background: var(--surface); margin-bottom: 10px; }
details.adm-fold > summary{ list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; min-height: 48px; font-size: 15px; }
details.adm-fold > summary::-webkit-details-marker{ display: none; }
details.adm-fold > summary::after{ content: ""; width: 9px; height: 9px; border-right: 2px solid var(--text-muted); border-bottom: 2px solid var(--text-muted); transform: rotate(45deg); transition: transform .15s ease; flex: 0 0 auto; margin-left: auto; margin-right: 4px; }
details.adm-fold[open] > summary::after{ transform: rotate(-135deg); }
details.adm-fold > summary .adm-fold-meta{ display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; min-width: 0; }
details.adm-fold > .adm-card, details.adm-fold > .bm-role{ border: 0; border-top: 1px solid var(--border); border-radius: 0 0 var(--radius-md, 12px) var(--radius-md, 12px); margin: 0; }
details.adm-fold > .adm-card > .adm-card-top > div:first-child, details.adm-fold > .bm-role > .bm-role-top > div:first-child{ display: none; }
details.adm-fold > .adm-card > .adm-card-top, details.adm-fold > .bm-role > .bm-role-top{ justify-content: flex-end; }

/* Flat card (Resident Directory): plain sections, one line per fact, nothing boxed inside a box. */
.fc{ display: flex; flex-direction: column; }
.fc-sec{ padding: 14px 0; border-top: 1px solid var(--border); }
.fc-sec:first-child{ border-top: 0; padding-top: 4px; }
.fc-h{ margin: 0 0 6px; font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); }
.fc-name{ margin: 0; font-size: 17px; font-weight: 700; color: var(--navy-text); overflow-wrap: anywhere; }
.fc-sub{ margin: 2px 0 0; font-size: 13px; color: var(--text-muted); overflow-wrap: anywhere; }
.fc-rows{ margin: 10px 0 0; display: grid; gap: 2px; }
.fc-row{ display: grid; grid-template-columns: 76px minmax(0, 1fr); align-items: center; gap: 8px; min-height: 36px; }
.fc-row dt{ font-size: 12.5px; color: var(--text-muted); }
.fc-row dd{ margin: 0; display: flex; align-items: center; gap: 4px; font-size: 14.5px; min-width: 0; }
.fc-val{ min-width: 0; overflow-wrap: anywhere; }
.fc-foot{ margin: 4px 0 0; font-size: 12px; color: var(--text-muted); }
.fc .dir-end{ margin-left: 6px; }
.contact-reveal-btn{ flex: 0 0 auto; width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; background: none; border: 0; border-radius: 8px; }
.contact-reveal-btn:active{ background: var(--surface-alt); }
.contact-reveal-btn .icon{ width: 18px; height: 18px; }

/* Empty date and time boxes on phones say what they are. */
@media (pointer: coarse){
  input[type="date"][data-empty]::before{ content: "Select date"; color: var(--text-muted); }
  input[type="time"][data-empty]::before{ content: "Select time"; color: var(--text-muted); }
  input[type="month"][data-empty]::before{ content: "Select month"; color: var(--text-muted); }
  input[type="date"][data-empty]:focus::before, input[type="time"][data-empty]:focus::before, input[type="month"][data-empty]:focus::before{ content: none; }
  input[type="date"], input[type="time"], input[type="month"]{ min-height: 44px; box-sizing: border-box; display: block; text-align: left; }
}

/* Touch screens: every tappable thing is at least about 40px tall; role access dropdowns have room for their words. */
@media (pointer: coarse){
  .adm-chip{ min-height: 40px; padding: 8px 14px; }
  .text-link-btn, .footer-link-btn{ min-height: 40px; display: inline-flex; align-items: center; }
  .adm-menu summary{ min-width: 44px; min-height: 40px; display: inline-flex; align-items: center; justify-content: center; }
  .adm-menu-list button{ min-height: 44px; }
}
@media (max-width: 639px){
  .adm-matrix tr{ grid-template-columns: 1fr 1fr; }
  .adm-matrix td.adm-c{ grid-column: 1 / -1; }
  .adm-matrix select{ min-width: 0; text-overflow: ellipsis; }
}

/* The hint sits inside the empty field and hides the browser's own dd/mm/yyyy, so there is only ever one line. */
@media (pointer: coarse){
  input[type="date"][data-empty], input[type="time"][data-empty], input[type="month"][data-empty]{ position: relative; }
  input[type="date"][data-empty]::before, input[type="time"][data-empty]::before, input[type="month"][data-empty]::before{ position: absolute; left: 12px; top: 50%; transform: translateY(-50%); pointer-events: none; }
  input[type="date"][data-empty]:not(:focus)::-webkit-datetime-edit, input[type="time"][data-empty]:not(:focus)::-webkit-datetime-edit, input[type="month"][data-empty]:not(:focus)::-webkit-datetime-edit{ opacity: 0; }
}

/* ==========================================================================
   1.9.3 Water Management: charts, tabs, tanks (js/modules/water/water.js)
   ========================================================================== */
.wt .adm-tabs{ margin-bottom: 14px; }
.wt-actions{ display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.wt-h-row{ display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
.wt-off{ opacity: .55; cursor: not-allowed; }
.wt-offnote{ margin: 0 0 12px; padding: 8px 12px; border: 1px dashed var(--border); border-radius: var(--radius-sm); }
.wt-click{ cursor: pointer; }
.wt-click:hover td{ background: var(--hover-row); }
.wt-click:focus-visible{ outline: 2px solid var(--green-mid); outline-offset: -2px; }
.wt-seg{ display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; margin: 8px 0 0; max-width: 100%; }
.wt-seg button{ border: 0; background: var(--surface); color: var(--text-muted); padding: 9px 14px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; min-height: 40px; }
.wt-seg button + button{ border-left: 1px solid var(--border); }
.wt-seg button.is-on{ background: var(--green-deep); color: #fff; }
.wt-chart{ margin-top: 8px; }
.wt-legend{ list-style: none; display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 0 0 6px; padding: 0; font-size: 12.5px; color: var(--text); }
.wt-legend li{ display: inline-flex; align-items: center; gap: 6px; }
.wt-dot{ width: 11px; height: 11px; border-radius: 3px; display: inline-block; }
.wt-chart-scroll{ overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); padding: 6px 4px 0; }
.wt-svg{ display: block; max-width: none; height: auto; }
.wt-svg text{ fill: var(--text); font-family: inherit; }
.wt-svg .wt-tick, .wt-svg .wt-xl{ fill: var(--text-muted); font-size: 11px; }
.wt-svg .wt-val{ font-size: 11px; font-weight: 600; paint-order: stroke; stroke: var(--surface); stroke-width: 3px; stroke-linejoin: round; }
.wt-svg .wt-grid{ stroke: var(--border); stroke-width: 1; }
.wt-svg .wt-zero{ stroke: var(--text-muted); stroke-width: 1.5; }
.wt-axis{ margin: 4px 2px 0; font-size: 12px; color: var(--text-muted); }
.wt-chk{ display: inline-block; padding: 2px 9px; border-radius: 10px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.wt-chk-ok{ background: var(--tint-green-strong); color: var(--green-text, #2E6B3E); }
.wt-chk-warn{ background: var(--tint-amber); color: var(--amber-text, #8A5A12); }
.wt-chk-off{ background: var(--tint-red); color: var(--red-text); }
.wt-tank{ margin: 10px 0; }
.wt-tank-head{ display: flex; justify-content: space-between; gap: 10px; font-size: 13.5px; margin-bottom: 4px; }
.wt-tank-head span{ color: var(--text-muted); }
.wt-tank-track{ height: 12px; border-radius: 7px; background: var(--surface-alt); overflow: hidden; }
.wt-tank-fill{ display: block; height: 100%; border-radius: 7px; background: var(--green-mid); }
.wt-tank-fill.is-low{ background: var(--red); }
.wt-dl{ display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px 16px; margin: 8px 0 0; }
.wt-dl dt{ font-size: 12px; color: var(--text-muted); }
.wt-dl dd{ margin: 0; font-size: 14.5px; overflow-wrap: anywhere; }
@media print{
  .wt .adm-tabs, .wt-filters, .wt-actions, .wt-seg, .wt-off, .wt-offnote, .site-footer, .sidebar, .topbar{ display: none !important; }
  .wt-chart-scroll{ overflow: visible; border: 0; }
}

/* Water: record ID and image file name in the reading details. */
.wt-mono{ font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; overflow-wrap: anywhere; word-break: break-all; }

/* Import dialog: notes that did not stop a row from being imported. */
.imp-note{ margin: 0 0 10px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-alt); color: var(--text); font-size: 13.5px; }
.imp-note p{ margin: 0 0 6px; }
.imp-note ul{ margin: 0; padding-left: 18px; }

/* ---------- One page layout for every record module (Vehicle, Resident Directory, Commercial, Expenses, Water) ----------
   1 page bar: where you are on the left, Data menu then the main "+ Add" button on the right
   2 tabs (only where a module has them)   3 summary tiles   4 search and filters   5 count line   6 the list
   Filters sit right above what they change. On a phone the bar keeps the actions on one row instead of stacking them. */
.page-bar{ position: relative; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px 12px; margin: 0 0 16px; }
.page-bar-context{ display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 0; flex: 1 1 auto; }
.page-bar-context .back-to-buildings-btn{ margin: 0 0 0 -8px; }
.page-bar-context .registry-building-title{ margin: 0; }
.page-bar-actions{ display: flex; align-items: center; gap: 8px; margin-left: auto; }
.page-bar-actions .btn{ white-space: nowrap; }
.page-bar-actions > .btn-primary{ order: 2; }
.page-bar-actions > .menu-wrap{ order: 3; }   /* the Data menu is always last: Add ..., Add ..., Data */
.page-bar .loading-note{ flex: 1 1 100%; }
/* The count line reads the same everywhere: how many on the left, then the active filters. */
.toolbar-status-row{ justify-content: flex-start; gap: 10px; }
.toolbar-status-row .result-count{ order: -1; }
@media (max-width: 639px){
  .page-bar-actions{ width: 100%; margin-left: 0; justify-content: flex-end; }
  .page-bar-actions > .btn-primary{ flex: 1 1 auto; justify-content: center; }
  .page-bar-actions > .menu-wrap{ position: static; }
  .page-bar-actions > .menu-wrap > .btn{ width: auto; }
  .page-bar .menu{ left: auto; right: 0; width: min(300px, 100%); min-width: 0; }
  .toolbar-status-row{ flex-direction: column; align-items: flex-start; gap: 6px; }
}

/* Five filters (for example Vehicle) fit on one row on a laptop screen. */
@media (min-width: 640px){ .toolbar-filters select{ flex: 1 1 128px; } }

/* Admin and My Society: the count line under the search row. */
.adm-count{ margin: -4px 0 12px; }

/* A role that can neither add nor export has nothing in the Data menu, so the menu and an otherwise empty page bar are not shown. */
.perm-noedit.perm-noexport .page-bar-actions > .menu-wrap{ display: none; }
.perm-noedit.perm-noexport .page-bar:has([data-role="dataMenuBtn"]):not(:has(.page-bar-context:not([hidden]))){ display: none; }

/* ---------- Expenses: Common and Building are told apart by colour, heading and section ----------
   Common (shared by buildings) is blue. Building (one building only) is green. The share a building pays of the common costs is blue
   too, in its own labelled section, because it is a common cost. */
.ex-is-common{ --ex-accent: var(--blue-text); --ex-tint: var(--tint-blue); }
.ex-is-building{ --ex-accent: var(--green-text); --ex-tint: var(--tint-green); }
.ex-tabs{ display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0 0 12px; }
.ex-tabs .ex-tab{ display: flex; flex-direction: row; align-items: center; gap: 12px; padding: 12px 14px; min-width: 0; text-align: left; border: 2px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text-muted); font: inherit; cursor: pointer; }
.ex-tabs .ex-tab-ico{ flex: 0 0 auto; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--surface-alt); }
.ex-tabs .ex-tab-ico .icon{ width: 20px; height: 20px; }
.ex-tabs .ex-tab-text{ display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.ex-tabs .ex-tab-text b{ font-size: 15px; color: var(--text); }
.ex-tabs .ex-tab-text small{ font-size: 12px; font-weight: 400; color: var(--text-muted); }
.ex-tabs .ex-tab-common.is-on{ border-color: var(--blue-text); background: var(--tint-blue); }
.ex-tabs .ex-tab-common.is-on .ex-tab-ico{ background: var(--blue-text); color: var(--surface); }
.ex-tabs .ex-tab-common.is-on b{ color: var(--blue-text); }
.ex-tabs .ex-tab-building.is-on{ border-color: var(--green-mid); background: var(--tint-green); }
.ex-tabs .ex-tab-building.is-on .ex-tab-ico{ background: var(--green-text); color: var(--surface); }
.ex-tabs .ex-tab-building.is-on b{ color: var(--green-text); }
.ex-banner{ display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 12px 20px; margin: 0 0 14px; padding: 14px 16px; border: 1px solid var(--border); border-left: 5px solid var(--ex-accent); border-radius: var(--radius); background: var(--surface); }
.ex-banner-text{ flex: 1 1 320px; min-width: 0; }
.ex-banner h2{ margin: 0 0 4px; font-size: 18px; color: var(--ex-accent); }
.ex-banner p{ margin: 0; font-size: 13.5px; line-height: 1.5; color: var(--text-muted); }
.ex-banner-pick{ display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: var(--text-muted); }
.ex-banner-pick[hidden]{ display: none; }
.ex-banner-pick select{ min-width: 220px; }
.ex-is-common .ex-event{ border-left: 4px solid var(--blue-text); }
.ex-is-building .ex-event{ border-left: 4px solid var(--green-mid); }
.ex-is-common .ex-event:hover{ border-color: var(--blue-text); }
.ex-section{ margin: 0 0 24px; }
.ex-section .ex-event{ margin-bottom: 10px; }
.ex-section-head{ display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0 0 10px; padding-bottom: 8px; border-bottom: 2px solid var(--border); }
.ex-section-head h3{ margin: 0; font-size: 16px; }
.ex-section-total{ font-weight: 700; white-space: nowrap; }
.ex-section-own .ex-section-head{ border-bottom-color: var(--green-mid); }
.ex-section-own .ex-section-head h3, .ex-section-own .ex-section-total{ color: var(--green-text); }
.ex-section-share .ex-section-head{ border-bottom-color: var(--blue-text); }
.ex-section-share .ex-section-head h3, .ex-section-share .ex-section-total{ color: var(--blue-text); }
.ex-section-note{ margin: -2px 0 10px; font-size: 13px; line-height: 1.5; color: var(--text-muted); }
.ex-is-building .ex-event.ex-event-share{ border-left-color: var(--blue-text); background: color-mix(in srgb, var(--tint-blue) 40%, var(--surface)); }
.ex-is-building .ex-event.ex-event-share:hover{ border-color: var(--blue-text); }
.ex-event-share .ex-mine{ color: var(--blue-text); }
.ex-tag{ font-size: 11px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; padding: 2px 8px; border-radius: 999px; }
.ex-tag-common{ background: var(--tint-blue); color: var(--blue-text); }
.ex-kind-opt-common:has(input:checked){ border-color: var(--blue-text); background: var(--tint-blue); }
.ex-kind-opt-building:has(input:checked){ border-color: var(--green-mid); background: var(--tint-green); }
.entry-form .form-field select + input{ margin-top: 8px; }
@media (max-width: 559px){
  .ex-tabs{ gap: 8px; }
  .ex-tabs .ex-tab{ padding: 10px; gap: 8px; }
  .ex-tabs .ex-tab-ico{ width: 30px; height: 30px; }
  .ex-tabs .ex-tab-text b{ font-size: 14px; }
  .ex-banner-pick, .ex-banner-pick select{ width: 100%; min-width: 0; }
}

/* Expenses: rupee figures with lakhs stay inside their tile on a phone. */
.ex .summary-card{ min-width: 0; }
.ex .summary-value{ font-size: clamp(18px, 5.6vw, 26px); overflow-wrap: anywhere; }

/* ---------- Expenses charts: spend by month or year, where the money went, who pays what ----------
   Phones: the month columns scroll sideways inside their own box and the category rows put the bar under the name.
   Tablets and up: the two lower cards sit side by side. Blue is common, green is a building's own cost, hatched blue is its share of common. */
.ex-charts{ display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; margin: 0 0 18px; }
.ex-charts[hidden]{ display: none; }
.ex-ch-card{ min-width: 0; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.ex-ch-head{ display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 12px; margin: 0 0 8px; }
.ex-ch-head b{ font-size: 15px; }
.ex-ch-sub{ font-size: 12.5px; color: var(--text-muted); }
.ex-ch-ctl{ display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ex-ch-seg{ display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; }
.ex-ch-seg button{ padding: 6px 14px; border: 0; background: transparent; color: var(--text-muted); font: inherit; font-size: 13px; cursor: pointer; }
.ex-ch-seg button[aria-pressed="true"]{ background: var(--tint-blue); color: var(--blue-text); font-weight: 600; }
.ex-is-building .ex-ch-seg button[aria-pressed="true"]{ background: var(--tint-green); color: var(--green-text); }
.ex-ch-link{ border: 0; background: none; padding: 6px 2px; color: var(--blue-text); font: inherit; font-size: 13px; text-decoration: underline; cursor: pointer; }
.ex-ch-chips{ display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 8px; }
.ex-ch-pill{ border: 1px solid var(--border-strong); border-radius: 999px; background: var(--tint-blue); color: var(--blue-text); padding: 4px 12px; font: inherit; font-size: 12.5px; cursor: pointer; }
.ex-ch-scroll{ overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 4px; }
.ex-ch-cols{ display: flex; align-items: flex-end; gap: 4px; height: 196px; min-width: 540px; border-bottom: 1px solid var(--border-strong); }
.ex-ch-labs{ display: flex; gap: 4px; min-width: 540px; margin-top: 4px; }
.ex-ch-lab{ flex: 1; min-width: 0; text-align: center; font-size: 11.5px; color: var(--text-muted); }
.ex-ch-lab.is-on{ color: var(--text); font-weight: 600; }
.ex-ch-col{ flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 3px; height: 100%; padding: 0; border: 0; background: transparent; color: var(--text); font: inherit; cursor: pointer; }
.ex-ch-col:hover .ex-ch-bar{ filter: brightness(1.1); }
.ex-ch-col.is-dim{ opacity: .35; }
.ex-ch-val{ font-size: 11px; font-weight: 600; color: var(--text-muted); white-space: nowrap; }
.ex-ch-bar{ width: 100%; max-width: 30px; display: flex; flex-direction: column; justify-content: flex-end; }
.ex-ch-own{ background: #639922; }
.ex-is-common .ex-ch-sc{ background: #378ADD; }
.ex-is-building .ex-ch-sc, .ex-ch-fill-share{ background-image: repeating-linear-gradient(45deg, #378ADD 0 3px, transparent 3px 6px); border: 1px solid #378ADD; }
.ex-ch-key{ display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin: 8px 0 0; font-size: 12px; color: var(--text-muted); }
.ex-ch-sw{ display: inline-block; width: 12px; height: 12px; border-radius: 2px; margin-right: -8px; }
.ex-ch-row{ display: grid; grid-template-columns: minmax(120px, 210px) minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; width: 100%; min-height: 44px; padding: 8px 8px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.ex-ch-row:hover{ background: var(--surface-alt); }
.ex-ch-row.is-on{ background: var(--tint-blue); }
.ex-ch-name{ font-size: 13.5px; overflow-wrap: anywhere; }
.ex-ch-track{ height: 14px; border-radius: 3px; background: var(--surface-alt); overflow: hidden; }
.ex-ch-fill{ display: block; height: 100%; }
.ex-ch-fill-com{ background: #378ADD; }
.ex-ch-fill-own{ background: #639922; }
.ex-ch-amt{ font-size: 13.5px; text-align: right; white-space: nowrap; }
.ex-ch-amt small{ font-size: 11.5px; color: var(--text-muted); }
.ex-anim .ex-ch-bar > div{ transform-origin: bottom; animation: exgrow .35s ease-out; }
.ex-anim .ex-ch-fill{ transform-origin: left; animation: exwide .35s ease-out; }
@keyframes exgrow{ from{ transform: scaleY(0); } }
@keyframes exwide{ from{ transform: scaleX(0); } }
@media (prefers-reduced-motion: reduce){ .ex-anim .ex-ch-bar > div, .ex-anim .ex-ch-fill{ animation: none; } }
@media (min-width: 720px){
  .ex-charts{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ex-charts > .ex-ch-card:first-child, .ex-charts > .ex-ch-card:nth-child(2):last-child{ grid-column: 1 / -1; }
}
@media (max-width: 559px){
  .ex-ch-row{ grid-template-columns: minmax(0, 1fr) auto; }
  .ex-ch-track{ grid-column: 1 / -1; order: 3; }
  .ex-ch-cols, .ex-ch-labs{ min-width: 480px; }
}
/* A chart card can be narrow on a wide screen (two cards side by side next to the sidebar): the rows stack by the card's own width, not the screen's */
.ex-ch-card{ container-type: inline-size; }
@container (max-width: 440px){
  .ex-ch-row{ grid-template-columns: minmax(0, 1fr) auto; }
  .ex-ch-track{ grid-column: 1 / -1; order: 3; }
}@media (pointer: coarse){ .ex-ch-seg button, .ex-ch-link, .ex-ch-pill{ min-height: 40px; } }

/* Expenses charts: the small controls are at least 38px tall on every screen (40px on touch). */
.ex-ch-seg button, .ex-ch-link, .ex-ch-pill{ min-height: 38px; }

/* Expenses tiles: from tablet width the figures stay on one line, so the tiles are wider; on a phone they may wrap rather than be cut. */
@media (min-width: 560px){
  .ex .summary{ grid-template-columns: repeat(auto-fit, minmax(172px, 1fr)); }
  .ex .summary-value{ white-space: nowrap; font-size: 22px; overflow-wrap: normal; }
}

/* Chart tooltip: one small card beside the bar, row or column it describes (hover, keyboard focus, or a tap on a phone). */
.ex-tip{ position: fixed; z-index: 70; max-width: min(300px, calc(100vw - 16px)); padding: 8px 12px; border-radius: 8px; background: var(--text); color: var(--surface); font-size: 12.5px; line-height: 1.45; box-shadow: var(--shadow-md); pointer-events: none; }
.ex-tip[hidden]{ display: none; }
.ex-tip b{ display: block; font-size: 13px; margin-bottom: 2px; }
.ex-tip span{ display: block; }
.ex-ch-col:focus-visible, .ex-ch-row:focus-visible{ outline: 2px solid var(--blue-text); outline-offset: 2px; }

/* Resident Directory form: the line under the Tenant heading has room before the first field. */
[data-tenant] .dir-hint{ margin: 0 0 12px; }

/* ---------- Activity fund: received and used, two bars side by side ---------- */
.ex-ch-fund{ background: #EF9F27; }
.ex-fd .ex-ch-sub{ margin: 0 0 10px; font-size: 12.5px; color: var(--text-muted); }
.ex-fd-stats{ display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0 0 12px; }
.ex-fd-stats > div{ padding: 8px 10px; border-radius: var(--radius-sm); background: var(--surface-alt); border-left: 3px solid var(--green-mid); min-width: 0; }
.ex-fd-stats > div:nth-child(2){ border-left-color: #EF9F27; }
.ex-fd-stats > .ex-fd-bal{ border-left-color: var(--blue-text); }
.ex-fd-stats small{ display: block; font-size: 11.5px; color: var(--text-muted); }
.ex-fd-stats b{ font-size: 16px; white-space: nowrap; }
.ex-fd-year{ min-height: 38px; padding: 4px 10px; }
.ex-fd .ex-ch-bar.ex-fd-pair{ flex-direction: row; align-items: flex-end; justify-content: center; gap: 2px; max-width: 44px; }
.ex-fd-got, .ex-fd-used, .ex-fd-none{ flex: 1 1 0; min-width: 0; max-width: 20px; }
.ex-fd-got{ background: #639922; }
.ex-fd-used{ background: #EF9F27; }
.ex-fd-none{ height: 0; }
.ex-ch-sw.ex-fd-got, .ex-ch-sw.ex-fd-used{ flex: none; width: 12px; height: 12px; }
.ex-anim .ex-fd-got, .ex-anim .ex-fd-used{ transform-origin: bottom; animation: exgrow .35s ease-out; }
@media (max-width: 559px){ .ex-fd-stats{ grid-template-columns: 1fr; } .ex-fd-stats b{ font-size: 15px; } }
@media (min-width: 560px){ .ex-fd-stats b{ font-size: 18px; } }
.ex-fundcard{ margin: 0 0 18px; }
.ex-fundcard[hidden]{ display: none; }
.ex-fundbox input{ max-width: 260px; }

/* Smooth scrolling on phones: no live blur behind the header, no looping sky animation */
@media (max-width: 760px){
  .topbar{ -webkit-backdrop-filter: none !important; backdrop-filter: none !important; }
  :root .cloud-a, :root .cloud-b, :root .cloud-c, :root .star-tw{ animation: none !important; }
}

/* Polish: centred icon badges, even rows on phones, and one continuous background behind the two entrance cards */
.tl-cap .cap-ic{ display: flex; width: 52px; height: 52px; margin: 0 auto 14px; padding: 0; }
.tl-cap .cap-ic .icon{ display: block; margin: 0; }
.tl-cap li{ padding: 0 8px; min-width: 0; }
.tl-cap li span:not(.cap-ic){ text-wrap: balance; overflow-wrap: break-word; }
.tl-in > .cap-ic{ display: flex; margin: 0 auto 16px; }
.home-info .tl:first-child{ background: var(--bg); }
.home-wrap{ padding-bottom: 40px; }
@media (max-width: 759px){
  .tl-cap{ max-width: 340px; }
  .mods{ gap: 8px; margin-top: 32px; }
  .mods li{ padding: 8px 13px; font-size: 14px; gap: 7px; }
}
/* One palette with the hero: the tinted tiles fade in from and out to the page colour (sky tint by day, night blue by night), so there are no hard colour seams */
.tl-dark{ --tint: #CFE8F4; --tl-text: #0B2C48; --tl-soft: rgba(11,44,72,.78); --tl-ic: #0b5cad; --tl-icbg: rgba(11,92,173,.12);
  background: linear-gradient(180deg, var(--bg) 0, var(--tint) 22%, var(--tint) 78%, var(--bg) 100%); color: var(--tl-text); }
:root[data-theme="dark"] .tl-dark{ --tint: #16304a; --tl-text: #f3f7ff; --tl-soft: rgba(226,234,252,.8); --tl-ic: #9fd6f5; --tl-icbg: rgba(255,255,255,.1); }
.tl-dark::before{ background: radial-gradient(closest-side, rgba(255,255,255,.35), transparent); }
:root[data-theme="dark"] .tl-dark::before{ background: radial-gradient(closest-side, rgba(90,160,220,.16), transparent); }
.tl-dark h2{ color: var(--tl-text); }
.tl-dark .tl-sub, .tl-dark .tl-cap span:not(.cap-ic){ color: var(--tl-soft); }
.tl-dark .cap-ic{ background: var(--tl-icbg); color: var(--tl-ic); }
.tl-dark .tl-cap .icon, .tl-dark .cap-ic .icon, .tl-dark .mods .icon{ color: var(--tl-ic); }
.tl-dark .pill-fill{ background: #0b5cad; color: #fff; }
.tl-dark .pill-fill:hover{ background: #094a8d; }
.tl-dark .pill-line{ border-color: var(--tl-ic); color: var(--tl-ic); }
:root[data-theme="dark"] .tl-dark .pill-fill{ background: #fff; color: #0f2236; }
.tl-white, .faq-tile, .home-info .tl:last-child{ background: var(--bg); }
@media (max-width: 559px){
  .mods{ flex-direction: column; align-items: center; }
  .mods li{ width: 100%; max-width: 270px; justify-content: center; }
}
.tl-eyebrow{ margin: 0 0 14px; font-size: 13px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--blue-text); }
.tl-dark .tl-eyebrow{ color: var(--tl-ic); }
.tl + .tl{ border-top: 1px solid var(--border); }
.tl-dark + .tl, .tl + .tl-dark{ border-top: 0; }

/* Final: the information follows the site's own light and dark theme (green brand, no blue tints). All tiles are transparent over ONE slow
   gradient, so scrolling from top to bottom is a single continuous flow with no bands, borders or gaps. */
.home-info{ background: linear-gradient(180deg, var(--bg) 0, var(--surface-alt) 38%, var(--surface-alt) 62%, var(--bg) 100%); }
.tl, .tl-dark, .tl-white, .home-info .tl:first-child, .home-info .tl:last-child{ background: transparent; border-top: 0; }
.tl + .tl, .tl-dark + .tl, .tl + .tl-dark{ border-top: 0; }
.tl-dark, :root[data-theme="dark"] .tl-dark{ --tl-text: var(--navy-text); --tl-soft: var(--text-muted); --tl-ic: var(--green-text); --tl-icbg: var(--tint-green, rgba(46,107,62,.12)); color: var(--text); }
.tl-dark::before{ display: none; }
.tl-dark h2{ color: var(--navy-text); }
.tl-eyebrow, .tl-dark .tl-eyebrow{ color: var(--green-text); }
.cap-ic, .tl-dark .cap-ic{ background: var(--tint-green, rgba(46,107,62,.12)); color: var(--green-text); }
.tl-cap .icon, .tl-dark .tl-cap .icon, .cap-ic .icon, .tl-dark .cap-ic .icon, .mods .icon, .tl-dark .mods .icon{ color: var(--green-text); }
.pill-fill, .tl-dark .pill-fill, :root[data-theme="dark"] .tl-dark .pill-fill{ background: var(--green-deep); color: #fff; }
.pill-fill:hover, .tl-dark .pill-fill:hover{ background: var(--primary-hover); }
.pill-line, .tl-dark .pill-line{ border-color: var(--green-text); color: var(--green-text); background: transparent; }
.pill-line:hover, .tl-dark .pill-line:hover{ background: var(--tint-green, rgba(46,107,62,.1)); }
.pill-btn:focus-visible{ outline-color: var(--green-text); }
.faq summary, .faq a{ color: var(--text); }
.faq a{ color: var(--green-text); }
/* Clear sections: each one is its own soft-edged band. Odd sections sit on the page colour, even ones on a slightly deeper shade,
   and the edges blend over 56px so the scroll stays smooth while you can still see where one section ends and the next begins. */
.home-info{ background: var(--bg); }
.home-info .tl:nth-child(even), .home-info .tl-dark:nth-child(even), .home-info .tl-white:nth-child(even){
  background: linear-gradient(180deg, var(--bg) 0, var(--surface-alt) 56px, var(--surface-alt) calc(100% - 56px), var(--bg) 100%);
}
.home-info .tl:nth-child(odd), .home-info .tl-white:nth-child(odd), .home-info .tl-dark:nth-child(odd){ background: transparent; }
.tl-eyebrow{ display: inline-block; padding: 6px 14px; border-radius: 980px; background: var(--tint-green, rgba(46,107,62,.12)); margin-bottom: 18px; }
/* Final seams: clean solid bands, no gradient haze. Tighter spacing so there is no empty strip between sections. */
.home-info .tl:nth-child(even), .home-info .tl-dark:nth-child(even), .home-info .tl-white:nth-child(even){ background: var(--surface-alt); }
.home-info .tl{ padding: 64px 20px; }
@media (min-width: 760px){ .home-info .tl{ padding: 88px 28px; } }
html[data-theme="dark"] .pill-fill, html[data-theme="dark"] .tl-dark .pill-fill{ background: var(--green-deep); color: #fff; }
html[data-theme="dark"] .pill-fill:hover{ background: var(--primary-hover); }
html[data-theme="dark"] .pill-line{ border-color: var(--green-text); color: var(--green-text); }

/* Desktop: sections alternate left and right. The message sits on one side, the details on the other, then they swap. Phones stay stacked. */
@media (min-width: 720px){
  .home-info .tl-in:has(.tl-cap){ display: grid; grid-template-columns: 1fr 1fr; column-gap: clamp(28px, 6vw, 72px); align-items: center; max-width: 1040px; text-align: left; }
  .home-info .tl-in:has(.tl-cap) > .tl-eyebrow, .home-info .tl-in:has(.tl-cap) > h2, .home-info .tl-in:has(.tl-cap) > .tl-sub, .home-info .tl-in:has(.tl-cap) > .tl-btns{ grid-column: 1; justify-self: start; }
  .home-info .tl-in:has(.tl-cap) > .tl-sub{ margin-left: 0; }
  .home-info .tl-in:has(.tl-cap) > .tl-btns{ justify-content: flex-start; }
  .home-info .tl-in:has(.tl-cap) > .tl-cap{ grid-column: 2; grid-row: 1 / span 5; grid-template-columns: 1fr; gap: 14px; margin: 0; max-width: none; text-align: left; }
  .home-info .tl-in:has(.tl-cap) > .tl-cap.four{ max-width: none; }
  .home-info .tl-in:has(.tl-cap) > .mods{ grid-column: 1; justify-content: flex-start; margin-top: 28px; }
  .home-info .tl:nth-child(even) .tl-in:has(.tl-cap) > .tl-eyebrow, .home-info .tl:nth-child(even) .tl-in:has(.tl-cap) > h2, .home-info .tl:nth-child(even) .tl-in:has(.tl-cap) > .tl-sub, .home-info .tl:nth-child(even) .tl-in:has(.tl-cap) > .tl-btns, .home-info .tl:nth-child(even) .tl-in:has(.tl-cap) > .mods{ grid-column: 2; }
  .home-info .tl:nth-child(even) .tl-in:has(.tl-cap) > .tl-cap{ grid-column: 1; }
  .home-info .tl-cap li{ display: grid; grid-template-columns: 52px 1fr; column-gap: 16px; align-items: center; text-align: left; padding: 16px 18px; border-radius: 16px; background: var(--surface); border: 1px solid var(--border); }
  .home-info .tl-cap li .cap-ic{ grid-row: 1 / span 2; margin: 0; }
  .home-info .tl-cap li b{ align-self: end; }
  .home-info .tl-cap li span:not(.cap-ic){ margin-top: 2px; align-self: start; }
}
@media (min-width: 720px) and (max-width: 899px){ .home-info .tl-cap li{ padding: 14px 14px; column-gap: 12px; } .home-info .tl-in:has(.tl-cap) > h2{ font-size: clamp(30px, 5vw, 44px); } }

/* Footer: brand line, one row of links, then the small print (the layout most sites use) */
.footer{ text-align: center; }
.footer-brand{ margin: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.footer-brand b{ font-size: 15px; font-weight: 700; color: var(--navy-text); }
.footer-brand span{ font-size: 13px; color: var(--text-muted); }
.footer-links{ display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 22px; margin: 14px 0 16px; }
.footer-links a{ font-size: 14px; font-weight: 600; }
.footer .footer-credit{ margin: 0 auto; max-width: 560px; font-size: 12.5px; line-height: 1.7; color: var(--text-muted); }.footer{ padding-top: 28px; border-top: 1px solid var(--border); }
.footer-addr{ margin: 8px auto 0; max-width: 520px; font-size: 13px; line-height: 1.5; color: var(--text-muted); }
.footer-addr[hidden]{ display: none; }

/* Footer in columns, left aligned, small print in a bar underneath (the usual website footer) */
.footer{ text-align: left; padding: 40px 20px 28px; }
.footer-grid{ display: grid; grid-template-columns: 1fr 1fr; gap: 28px 24px; max-width: 1040px; margin: 0 auto; }
.footer-about{ grid-column: 1 / -1; }
.footer-brand{ align-items: flex-start; }
.footer-col h4{ margin: 0 0 12px; font-size: 12.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--text-muted); }
.footer-col a{ display: block; margin: 0 0 10px; font-size: 14.5px; font-weight: 500; text-decoration: none; color: var(--text); overflow-wrap: anywhere; }
.footer-col a:hover{ color: var(--green-text); text-decoration: underline; }
.footer-note{ display: block; font-size: 13px; line-height: 1.5; color: var(--text-muted); }
.footer-addr{ margin: 10px 0 0; max-width: 360px; text-align: left; font-size: 14px; line-height: 1.55; }
.footer .footer-credit{ max-width: 1040px; margin: 32px auto 0; padding-top: 20px; border-top: 1px solid var(--border); text-align: left; font-size: 12.5px; line-height: 1.7; }
@media (min-width: 720px){
  .footer-grid{ grid-template-columns: 1.5fr 1fr 1fr; gap: 40px; }
  .footer-about{ grid-column: auto; }
}@media (max-width: 719px){ .footer-grid > .footer-col:last-child{ grid-column: 1 / -1; } }
.footer-addr{ white-space: pre-line; }

/* Footer spacing: even, tight rhythm; links line up exactly with the headings (no side padding, no big gaps) */
.footer .footer-col a, .footer .footer-col .footer-link-btn{ display: block; margin: 0; padding: 5px 0; line-height: 1.4; }
.footer-col h4{ margin: 0 0 6px; }
.footer-note{ margin-top: 6px; }
.footer-grid{ gap: 24px 24px; }
.footer-brand b{ line-height: 1.3; }
.footer-addr{ margin-top: 8px; }
@media (min-width: 720px){ .footer-grid{ gap: 40px; } }
/* Footer C: brand panel with an Email us button, Platform and Legal columns, one bar underneath */
.footer-brand b{ font-size: 17px; }
.footer-col a.footer-cta{ display: inline-block; margin: 16px 0 0; padding: 8px 16px; border: 1px solid var(--border-strong); border-radius: 980px; font-size: 14px; font-weight: 600; color: var(--text); }
.footer-col a.footer-cta:hover{ background: var(--tint-green, rgba(46,107,62,.1)); color: var(--green-text); text-decoration: none; }
.footer .footer-bar{ display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 24px; }
@media (max-width: 719px){ .footer-grid > .footer-col:last-child{ grid-column: auto; } .footer-about{ grid-column: 1 / -1; } }.footer .footer-col a.footer-cta{ padding: 9px 18px; margin: 16px 0 0; border: 1px solid var(--green-text); color: var(--green-text); line-height: 1.2; }

/* ---------- Money modules: Overview and Collections (js/modules/ledger) ---------- */
.ex-tabs{ grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.ex-tabs .ex-tab-overview.is-on, .ex-tabs .ex-tab-income.is-on{ border-color: var(--green-mid); background: var(--tint-green); }
.ex-tabs .ex-tab-overview.is-on .ex-tab-ico, .ex-tabs .ex-tab-income.is-on .ex-tab-ico{ background: var(--green-text); color: var(--surface); }
.ex-tabs .ex-tab-overview.is-on b, .ex-tabs .ex-tab-income.is-on b{ color: var(--green-text); }
.lv .ex-ch-bar.ex-fd-pair{ flex-direction: row; align-items: flex-end; justify-content: center; gap: 2px; max-width: 44px; }
.lv .ex-ch-card{ margin-top: 12px; }
.lv-rows{ display: grid; gap: 8px; margin-top: 10px; }
.lv-row{ display: grid; grid-template-columns: minmax(90px, 1.2fr) 3fr minmax(120px, auto); gap: 12px; align-items: center; width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.lv-row:hover{ border-color: var(--border-strong, var(--green-mid)); }
.lv-name{ font-weight: 600; overflow-wrap: anywhere; }
.lv-bars{ display: grid; gap: 4px; min-width: 0; }
.lv-bar{ display: block; height: 9px; border-radius: 5px; min-width: 0; }
.lv-got{ background: #639922; }
.lv-out{ background: #EF9F27; }
.lv-amt{ font-size: 13px; color: var(--text-muted); text-align: right; white-space: nowrap; }
.lv-amt b{ color: var(--text); font-weight: 600; }
@media (max-width: 640px){
  .lv-row{ grid-template-columns: 1fr; gap: 6px; }
  .lv-amt{ text-align: left; white-space: normal; }
}.lv .ex-ch-head{ flex-wrap: wrap; gap: 8px; }
.lv .ex-ch-ctl{ flex-wrap: wrap; gap: 8px; max-width: 100%; }
.lv .ex-ch-seg{ flex-wrap: wrap; max-width: 100%; }
.lv .ex-ch-seg button{ white-space: nowrap; }
.ex-perflat{ display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ex-perflat input{ width: 8.5rem; }
.ex-perflat-eq{ font-weight: 600; color: var(--green-text); }
.page-bar-actions{ flex-wrap: wrap; }
@media (max-width: 480px){ .lv .summary-value, .ex .summary-value{ font-size: 18px; overflow-wrap: anywhere; } .lv .summary-card, .ex .summary-card{ min-width: 0; } }
@media (max-width: 480px){ .lv .summary-value, .ex .summary-value{ font-size: 17px; white-space: nowrap; overflow-wrap: normal; } }

/* ---------- Charts: a figure axis down the left, grid lines, columns that start from the left, and a smooth grow-in ---------- */
.ex-chart{ display: flex; align-items: flex-start; gap: 6px; }
.ex-chart .ex-ch-scroll{ flex: 1 1 auto; min-width: 0; }
.ex-yaxis{ position: relative; flex: 0 0 46px; margin-top: 46px; }
.ex-yaxis span{ position: absolute; right: 2px; transform: translateY(50%); font-size: 11px; line-height: 1; color: var(--text-muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.ex-ch-cols{ position: relative; }
.ex-grid{ position: absolute; left: 0; right: 0; bottom: 0; pointer-events: none; z-index: 0; }
.ex-grid i{ position: absolute; left: 0; right: 0; height: 0; border-top: 1px dashed var(--border); }
.ex-grid i:first-child{ border-top: 0; }
.ex-ch-cols .ex-ch-col{ position: relative; z-index: 1; }
.ex-ch-cols.is-few, .ex-ch-labs.is-few{ min-width: 0; justify-content: flex-start; }
.ex-ch-cols.is-few .ex-ch-col, .ex-ch-labs.is-few .ex-ch-lab{ flex: 0 0 78px; }
.ex-ch-bar{ max-width: 34px; }
/* grow-in: columns rise from the baseline, rows extend from the left, each a little after the one before */
.ex-anim .ex-ch-bar > div, .ex-anim .ex-fd-got, .ex-anim .ex-fd-used{ transform-origin: bottom; animation: exgrow .7s cubic-bezier(.2,.7,.2,1) both; animation-delay: calc(var(--i, 0) * 35ms); }
.ex-anim .ex-ch-fill, .lv.ex-anim .lv-bar{ transform-origin: left; animation: exwide .7s cubic-bezier(.2,.7,.2,1) both; animation-delay: calc(var(--i, 0) * 45ms); }
.ex-anim .ex-ch-col:nth-child(n){ --i: 0; }
.lv.ex-anim .ex-ch-col .ex-fd-got, .lv.ex-anim .ex-ch-col .ex-fd-used{ animation-delay: calc(var(--i, 0) * 35ms); }
.lv-axisrow{ cursor: default; border: 0; background: transparent; padding-top: 0; padding-bottom: 0; }
.lv-ticks{ display: flex; justify-content: space-between; font-size: 11px; color: var(--text-muted); }
.lv-bars{ background-image: repeating-linear-gradient(to right, var(--border) 0 1px, transparent 1px 25%); background-size: calc(100% - 1px) 100%; background-repeat: no-repeat; border-right: 1px solid var(--border); border-left: 1px solid var(--border-strong, var(--border)); padding: 2px 0; }
.ex-ch-card .ex-ch-col .ex-ch-val{ min-height: 14px; }
@media (prefers-reduced-motion: reduce){ .ex-anim .ex-ch-bar > div, .ex-anim .ex-fd-got, .ex-anim .ex-fd-used, .ex-anim .ex-ch-fill, .lv.ex-anim .lv-bar{ animation: none; } }
@media (max-width: 640px){ .ex-yaxis{ flex-basis: 40px; } .ex-yaxis span{ font-size: 10px; } }.ghp-tip{ white-space: pre-line; }

/* ---------- One gentle, linear grow for every bar in the portal: slow enough to follow, nothing staggered or jumpy ---------- */
.ex-anim .ex-ch-bar > div, .ex-anim .ex-fd-got, .ex-anim .ex-fd-used, .lv.ex-anim .ex-ch-col .ex-fd-got, .lv.ex-anim .ex-ch-col .ex-fd-used{ animation: exgrow .8s linear both; animation-delay: 0s; }
.ex-anim .ex-ch-fill, .lv.ex-anim .lv-bar{ animation: exwide .8s linear both; animation-delay: 0s; }
.wt-bar-fill, .wt-tank-fill{ transform-origin: left; animation: exwide .8s linear both; }
.wt-svg rect{ transform-box: fill-box; transform-origin: bottom; animation: exgrow .8s linear both; }
.wt-line{ stroke-dasharray: 1; animation: wtdraw .8s linear both; }
@keyframes wtdraw{ from{ stroke-dashoffset: 1; } to{ stroke-dashoffset: 0; } }
@media (prefers-reduced-motion: reduce){ .wt-bar-fill, .wt-tank-fill, .wt-svg rect, .wt-line{ animation: none; stroke-dasharray: none; } }
/* Overview columns: every bar carries its real figure; one kind of figure = one wide bar, two kinds = two bars side by side */
.lv .ex-ch-bar.ex-fd-pair{ max-width: none; width: 82%; gap: 3px; align-items: flex-end; justify-content: center; }
.lv .ex-ch-cols.is-single .ex-ch-bar.ex-fd-pair{ width: 66%; }
.ex-sw{ flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 3px; }
.ex-sw .ex-fd-got, .ex-sw .ex-fd-used{ width: 100%; max-width: none; flex: none; }
.ex-sv{ font-size: 10.5px; font-weight: 600; line-height: 1; color: var(--text-muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.ex-sv.is-v{ writing-mode: vertical-rl; transform: rotate(180deg); font-size: 10px; }.lv-bars.is-single .lv-bar{ height: 14px; border-radius: 7px; }
@media (max-width: 380px){ .lv .summary{ grid-template-columns: 1fr; } }

/* ---------- Announcement strip and the Plans and fees notice (js/core/banner.js) ---------- */
.ghp-strip{ background: var(--tint-green); border-bottom: 1px solid var(--border); color: var(--text); font-size: 13.5px; line-height: 1.4; }
.ghp-strip[hidden]{ display: none; }
.strip-in{ display: flex; align-items: center; gap: 10px; max-width: 1180px; margin: 0 auto; padding: 8px 16px; }
.strip-in .icon{ width: 18px; height: 18px; flex: none; color: var(--green-text); }
.strip-text{ flex: 1; min-width: 0; }
.strip-link{ flex: none; border: 0; background: transparent; color: var(--green-text); font: inherit; font-weight: 600; text-decoration: underline; cursor: pointer; padding: 4px 2px; }
.strip-x{ flex: none; width: 28px; height: 28px; border: 0; border-radius: 50%; background: transparent; color: var(--text-muted); font-size: 20px; line-height: 1; cursor: pointer; }
.strip-x:hover{ background: var(--surface-alt); color: var(--text); }
@media (max-width: 520px){ .strip-in{ flex-wrap: wrap; row-gap: 2px; } .strip-text{ flex-basis: calc(100% - 40px); } }
.plans-note{ font-size: 15px; line-height: 1.6; color: var(--text); }
.plans-lead{ margin: 0 0 14px; font-size: 16px; }
.plans-grid{ display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 0 0 14px; }
.plans-grid > div{ padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-alt); }
.plans-grid h3{ margin: 0 0 6px; font-size: 14px; letter-spacing: .02em; color: var(--green-text); }
.plans-grid ul, .plans-promise{ margin: 0; padding-left: 18px; }
.plans-grid li, .plans-promise li{ margin: 3px 0; font-size: 14px; color: var(--text-muted); }
.plans-promise{ margin-bottom: 12px; }
.plans-contact{ margin: 0; font-size: 14px; color: var(--text-muted); }
@media (max-width: 560px){ .plans-grid{ grid-template-columns: 1fr; } }

/* ---------- Hive Bazaar (js/modules/bazaar) ---------- */
.bz-head h1{ margin: 0 0 4px; font-size: 28px; line-height: 1.2; color: var(--text); }
.bz-head p{ margin: 0 0 16px; color: var(--text-muted); font-size: 15.5px; max-width: 60ch; }
.bz-note{ margin: 0 0 14px; padding: 10px 14px; border: 1px dashed var(--border-strong, var(--border)); border-radius: var(--radius); background: var(--surface-alt); font-size: 14px; color: var(--text-muted); }
.bz-note b{ color: var(--text); }
.bz-search{ display: flex; align-items: center; gap: 8px; padding: 0 14px; height: 46px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); max-width: 520px; }
.bz-search .icon{ width: 18px; height: 18px; color: var(--text-muted); flex: none; }
.bz-search input{ flex: 1; min-width: 0; border: 0; background: transparent; color: var(--text); font: inherit; outline: 0; }
.bz-chips{ display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0 18px; }
.bz-chip{ display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text); font: inherit; font-size: 14px; cursor: pointer; }
.bz-chip small{ color: var(--text-muted); font-size: 12px; }
.bz-chip.is-on{ background: var(--green-deep); border-color: var(--green-deep); color: #fff; }
.bz-chip.is-on small{ color: rgba(255,255,255,.8); }
.bz-grid{ display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.bz-card{ display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); overflow: hidden; }
.bz-top{ position: relative; height: 84px; display: flex; align-items: flex-end; padding: 0 16px; }
.bz-t-green{ background: rgba(46,125,50,.16); } .bz-t-amber{ background: rgba(230,160,40,.18); } .bz-t-blue{ background: rgba(55,138,221,.16); } .bz-t-violet{ background: rgba(130,110,220,.16); } .bz-t-red{ background: rgba(226,75,74,.14); }
.bz-ava{ transform: translateY(24px); width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; font-weight: 700; font-size: 20px; color: #fff; background: var(--green-deep); border: 3px solid var(--surface); }
.bz-t-amber .bz-ava{ background: #b9770e; } .bz-t-blue .bz-ava{ background: #1f6fb5; } .bz-t-violet .bz-ava{ background: #6a4fc4; } .bz-t-red .bz-ava{ background: #c0392b; }
.bz-ribbon{ position: absolute; right: 12px; top: 12px; padding: 3px 10px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); font-size: 11.5px; font-weight: 600; color: var(--text-muted); letter-spacing: .04em; text-transform: uppercase; }
.bz-body{ padding: 34px 16px 12px; flex: 1; }
.bz-cat{ font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--green-text); }
.bz-body h3{ margin: 4px 0 6px; font-size: 18px; color: var(--text); }
.bz-tagline{ margin: 0 0 8px; font-size: 14.5px; line-height: 1.5; color: var(--text-muted); }
.bz-offer{ margin: 0 0 10px; padding: 6px 10px; border-radius: 8px; background: var(--tint-green); color: var(--green-text); font-size: 13.5px; font-weight: 600; }
.bz-meta{ list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 4px; font-size: 13.5px; color: var(--text-muted); }
.bz-meta li{ display: flex; align-items: center; gap: 8px; }
.bz-meta .icon{ width: 16px; height: 16px; flex: none; }
.bz-tags{ display: flex; gap: 6px; flex-wrap: wrap; }
.bz-tags span{ padding: 2px 10px; border-radius: 999px; background: var(--surface-alt); font-size: 12.5px; color: var(--text-muted); }
.bz-foot{ display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 12px 16px; border-top: 1px solid var(--border); }
.bz-verified, .bz-pending{ display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--green-text); }
.bz-verified .icon{ width: 16px; height: 16px; }
.bz-pending{ color: var(--text-muted); font-weight: 500; }
.bz-btns{ display: inline-flex; gap: 8px; }
.bz-valid{ display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-muted); }
.bz-valid .icon{ width: 14px; height: 14px; }
.bz-how{ margin: 8px 0 0; font-size: 12.5px; color: var(--text-muted); }
.bz-btn{ display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border); font-size: 13px; font-weight: 600; color: var(--text-muted); opacity: .75; cursor: not-allowed; }
.bz-btn .icon{ width: 15px; height: 15px; }
.bz-none{ grid-column: 1 / -1; margin: 8px 0; color: var(--text-muted); }
.bz-cta{ display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: 22px; padding: 18px 20px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface-alt); }
.bz-cta h2{ margin: 0 0 4px; font-size: 18px; color: var(--text); }
.bz-cta p{ margin: 0; max-width: 62ch; font-size: 14.5px; color: var(--text-muted); }
/* The small Table | Chart switch (two icon buttons) and the Export CSV button at the right end of a chart header */
.ghp-viewtoggle{ display: inline-flex; padding: 2px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); }
.ghp-viewtoggle button{ display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 28px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--text-muted); cursor: pointer; }
.ghp-viewtoggle button:hover{ color: var(--text); }
.ghp-viewtoggle button[aria-pressed="true"]{ background: var(--tint-green); color: var(--green-text); }
.ghp-viewtoggle .icon{ width: 16px; height: 16px; }
@media (pointer: coarse){ .ghp-viewtoggle button{ width: 38px; height: 36px; } }
.ex-ch-export{ display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; font-size: 13px; min-height: 34px; }
.ex-ch-export .icon{ width: 15px; height: 15px; }
.ex-ch-head .ex-ch-ctl{ flex: 1 1 100%; justify-content: flex-start; row-gap: 8px; }
.ex-ch-ctl > .ghp-viewtoggle{ margin-left: auto; }
.lv .ex-ch-ctl{ max-width: none; }
/* Export buttons that are plain buttons (Water) also go last, like the Data menu: Add ..., then Export */
.page-bar-actions > [data-role^="export"]{ order: 3; }

/* ---------- One tab style everywhere: the underline strip (same as Water, My Building and Admin) ----------
   Money modules (Maintenance, Cultural, Commercial) and Events used cards and pills; they now match. */
.ex-tabs{ display: flex; flex-wrap: nowrap; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--border); margin: 0 0 16px; scrollbar-width: none; }
.ex-tabs::-webkit-scrollbar{ display: none; }
.ex-tabs .ex-tab{ display: block; flex: 0 0 auto; padding: 10px 14px; margin-bottom: -1px; background: none; border: 0; border-bottom: 3px solid transparent; border-radius: 0; color: var(--text-muted); font-size: 14px; font-weight: 600; white-space: nowrap; }
.ex-tabs .ex-tab:hover{ color: var(--text); }
.ex-tabs .ex-tab .ex-tab-ico, .ex-tabs .ex-tab small{ display: none; }
.ex-tabs .ex-tab .ex-tab-text b{ font-size: 14px; color: inherit; }
.ex-tabs .ex-tab.is-on{ background: none; color: var(--navy-text); border-bottom-color: var(--green-mid); }
.ex-tabs .ex-tab.is-on b{ color: var(--navy-text); }
.ev-bar{ border-bottom: 1px solid var(--border); align-items: flex-end; }
.ev-tabs{ display: flex; gap: 4px; padding: 0; background: none; border: 0; border-radius: 0; }
.ev-tab{ padding: 10px 14px; margin-bottom: -1px; border-radius: 0; border-bottom: 3px solid transparent; box-shadow: none; font-size: 14px; }
.ev-tab[aria-selected="true"]{ background: none; box-shadow: none; color: var(--navy-text); border-bottom-color: var(--green-mid); }
.ev-year{ padding-bottom: 8px; }
/* Buttons stay on one row on phones: Add collection, Add expense, Data. */
@media (max-width: 640px){
  .page-bar-actions{ flex-wrap: nowrap; gap: 6px; }
  .page-bar-actions > .btn{ flex: 1 1 0; min-width: 0; padding-left: 8px; padding-right: 8px; font-size: 13px; }
  .page-bar-actions > .menu-wrap{ flex: 0 0 auto; }
  .page-bar-actions > .menu-wrap > .btn{ padding-left: 10px; padding-right: 10px; font-size: 13px; }
}@media (max-width: 340px){ .page-bar-actions > .btn, .page-bar-actions > .menu-wrap > .btn{ font-size: 12px; padding-left: 6px; padding-right: 6px; } }

/* Resident Directory: six summary cards, three across (Total flats, Registered, Pending / Owner, Rented, Tenancy ending soon). */
@media (min-width: 720px){ .dir .summary{ grid-template-columns: repeat(3, 1fr); } }

/* ---------- Same look on every page (14 Nov 2026 review) ---------- */
/* 1. Summary cards: the last row stretches, so there are no gaps and no lone card. */
.summary.summary-fill{ display: flex; flex-wrap: wrap; gap: 10px; }
.summary.summary-fill > .summary-card{ flex: 1 1 calc(50% - 10px); min-width: 0; }
@media (min-width: 720px){
  .summary.summary-fill > .summary-card{ flex-basis: calc(25% - 10px); }
  .dir .summary.summary-fill > .summary-card{ flex-basis: calc(33.33% - 10px); }
  .wt .summary.summary-fill > .summary-card{ flex-basis: calc(20% - 10px); }
}
/* 2. (The Vehicles heading and buttons stay on one row, as before.) */
/* 3. My Society and Admin tiles look like the summary cards of the other modules. */
.adm-tile{ flex-direction: column-reverse; gap: 4px; border: 0; border-left: 4px solid var(--green-mid); box-shadow: var(--shadow-sm); }
.adm-tile:hover:not(.adm-tile-static){ border-left-color: var(--green-mid); box-shadow: var(--shadow-md, var(--shadow-sm)); }
.adm-tile .adm-lbl{ font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .02em; }
.adm-tile .adm-num{ color: var(--text); }
.adm-tile-hot{ background: var(--surface); border-left-color: var(--amber); }
.adm-tile-hot .adm-num{ color: var(--amber); }
/* 4. The first tab label lines up with the cards below it. */
.adm-tabs .adm-tab:first-child, .ex-tabs .ex-tab:first-child, .ev-tabs .ev-tab:first-child{ padding-left: 0; }
/* The intro box on every money tab is the same plain box (it was coloured only on Common and Building expenses). */
.ex-banner{ border-left: 1px solid var(--border); }
.ex-banner h2{ color: var(--text); }

/* The "by Month / Year / Society ..." choices are separate buttons (the chosen one filled), not loose text. */
.ex-ch-seg{ display: inline-flex; flex-wrap: wrap; gap: 6px; border: 0; border-radius: 0; overflow: visible; }
.ex-ch-seg button{ border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font-weight: 500; }
.ex-ch-seg button:hover{ border-color: var(--green-mid); }
.ex-ch-seg button[aria-pressed="true"], .ex-is-building .ex-ch-seg button[aria-pressed="true"]{ background: var(--tint-green); border-color: var(--green-mid); color: var(--green-text); font-weight: 600; }@media (min-width: 720px){ .summary.summary-fill.summary-auto > .summary-card{ flex-basis: 130px; } }
/* Card values line up on one baseline whatever the label length (one or two lines). */
.summary-card .summary-value{ margin-top: auto; }

/* Hive Bazaar front: a photo band, category, name, short description and verified line; the rest opens in a dialog. */
.bz-grid{ grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.bz-front{ cursor: pointer; }
.bz-front:hover, .bz-front:focus-visible{ border-color: var(--green-mid); }
.bz-front .bz-top{ height: 64px; }
.bz-front .bz-ava{ width: 52px; height: 52px; font-size: 18px; transform: translateY(22px); }
.bz-front .bz-body{ padding: 30px 14px 10px; }
.bz-front .bz-body h3{ font-size: 16.5px; }
.bz-front .bz-tagline{ margin: 0; font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.bz-front .bz-foot{ padding: 10px 14px; }
.bz-dlg .bz-card{ border: 0; border-radius: 0; background: transparent; }
.bz-dlg .bz-top{ border-radius: 12px; }
/* ---------- Phone fixes (from real Android screenshots, 14 Nov 2026) ---------- */
/* The header is solid on phones: without the blur the page scrolled visibly behind its title. */
@media (max-width: 760px){ .topbar{ background: var(--surface); } }
/* Recent activity rows were 180px tall on phones (a width meant for a row, used in a column). */
@media (max-width: 480px){ .adm-recent li span{ flex: 0 0 auto; } }
/* Water: two long buttons wrap to a second line instead of running over each other. */
.page-bar-actions.wt-actions{ flex-wrap: wrap; }
.page-bar-actions.wt-actions > .btn{ flex: 1 1 auto; min-width: 0; }
.wt-actions .btn{ white-space: normal; }
/* The flat card has the number once, in its title. */
.fc-hero .fc-title{ min-width: 0; }
/* Add vehicle form: flat and person first, then the vehicles; + Add another vehicle adds a row for each extra vehicle. */
.form-sub{ margin: 14px 0 8px; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); }
.vrow{ margin: 12px 0 0; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-alt); }
.vrow-head{ display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.vrow-title{ font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); }
.vrow-add{ margin-top: 12px; }

/* Spent by festival or event: a donut and, under each event, its categories. */
.pie-wrap{ display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; margin-top: 8px; }
.pie-svg{ flex: 0 0 auto; width: 190px; height: 190px; max-width: 100%; }
.pie-slice{ cursor: pointer; transition: opacity .15s ease; }
.pie-slice:hover{ opacity: .8; }
.pie-total{ font-size: 13px; font-weight: 700; fill: var(--text); }
.pie-sub{ font-size: 7px; fill: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; }
.pie-list{ flex: 1 1 260px; min-width: 0; list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.pie-row{ display: grid; grid-template-columns: 14px 1fr auto auto; align-items: center; column-gap: 8px; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; }
.pie-row:hover, .pie-row:focus-visible{ border-color: var(--green-mid); }
.pie-sw{ width: 12px; height: 12px; border-radius: 4px; }
.pie-name{ min-width: 0; overflow-wrap: anywhere; font-weight: 600; }
.pie-amt{ white-space: nowrap; }
.pie-pct{ min-width: 44px; text-align: right; font-size: 12px; color: var(--text-muted); }
.pie-cats{ grid-column: 2 / -1; list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 2px; font-size: 12.5px; color: var(--text-muted); }
.pie-cats li{ display: flex; justify-content: space-between; gap: 12px; }
.pie-cats li span:first-child{ min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 480px){ .pie-svg{ width: 100%; max-width: 240px; margin: 0 auto; } }@media (max-width: 480px){ .pie-row{ column-gap: 6px; padding: 8px; } .pie-name{ overflow-wrap: break-word; font-size: 14.5px; } .pie-amt{ font-size: 13.5px; } .pie-pct{ min-width: 36px; } }

/* Admin filters: a dated filter keeps its label beside the box */
.adm-datef{ display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-muted); white-space: nowrap; }
.adm-toolbar{ flex-wrap: wrap; }

/* Admin Health: the database meter */
.adm-meter{ height: 10px; border-radius: 999px; background: var(--surface-alt); border: 1px solid var(--border); overflow: hidden; margin: 6px 0; }
.adm-meter > span{ display: block; height: 100%; background: var(--green-mid); border-radius: 999px; }
.adm-bad{ color: var(--red-text, #c0392b); }

/* Admin Accounts: tick boxes and the bar for acting on several at once */
.adm-sel{ width: 34px; text-align: center; }
.adm-bulk{ display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 8px 0; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-alt); }

.adm-ann { max-width: 560px; }
.adm-ann textarea { width: 100%; resize: vertical; }
details.adm-fold > .adm-tablewrap, details.adm-fold > .adm-empty{ border-top: 1px solid var(--border); margin: 0; }
.adm-socs { border: 0; padding: 0; margin: 0 0 12px; display: flex; flex-wrap: wrap; gap: 6px 14px; }
.adm-socs legend { width: 100%; padding: 0; margin-bottom: 6px; font-weight: 600; font-size: 14px; }
.adm-soc { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; }

/* Password strength bar and the five things a password needs (sign in screens) */
.pw-meter{ display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.pw-bar{ display: flex; gap: 4px; flex: 1; }
.pw-bar i{ height: 5px; flex: 1; border-radius: 3px; background: var(--border); transition: background .15s ease; }
.pw-bar[data-level="1"] i:nth-child(-n+1){ background: var(--red); }
.pw-bar[data-level="2"] i:nth-child(-n+2){ background: var(--amber); }
.pw-bar[data-level="3"] i:nth-child(-n+3){ background: var(--green-mid); }
.pw-bar[data-level="4"] i{ background: var(--green-deep); }
.pw-label{ font-size: 12px; color: var(--text-muted); min-width: 92px; text-align: right; }
.pw-checks{ list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; color: var(--text-muted); }
.pw-checks li::before{ content: "\25CB\00a0"; }
.pw-checks li.ok{ color: var(--green-text); }
.pw-checks li.ok::before{ content: "\2713\00a0"; }

/* ---------- Email tab: the same field look as the sign in forms ---------- */
.adm-ann .gate-field{ margin-bottom: 14px; text-align: left; }
.adm-ann .gate-field label, .adm-ann legend{ display: block; margin-bottom: 6px; font-size: 13px; font-weight: 600; color: var(--text); }
.adm-ann input[type="text"], .adm-ann select, .adm-ann textarea{
  width: 100%; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font: inherit; font-size: 15px; background: var(--bg); color: var(--text);
}
.adm-ann textarea{ min-height: 150px; line-height: 1.5; resize: vertical; }
.adm-ann input[type="text"]:focus, .adm-ann select:focus, .adm-ann textarea:focus{ outline: none; border-color: var(--green-mid); box-shadow: 0 0 0 3px rgba(78,139,78,0.18); }
.adm-ann-actions{ display: flex; flex-wrap: wrap; gap: 10px; }
.adm-ann-actions .btn{ flex: 1 1 180px; justify-content: center; }




/* ---------- Committee list: avatar, name, flat and tag ---------- */
.cm-list{ list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.cm-item{ display: flex; align-items: center; gap: 12px; padding: 10px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md, 12px); }
.cm-avatar{ flex: 0 0 40px; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-size: 14px; font-weight: 700; letter-spacing: .02em; color: #fff; background: var(--green-mid); }
.cm-item.is-head .cm-avatar{ background: var(--green-deep); }
.cm-main{ flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.cm-name{ font-weight: 600; color: var(--text); overflow-wrap: anywhere; }
.cm-meta{ font-size: 12.5px; color: var(--text-muted); }
.cm-tag{ flex: 0 0 auto; }
@media (max-width: 420px){
  /* A narrow screen: the avatar stays beside the name, and the tag goes under the name (a long name wraps inside its own column) */
  .cm-item{ display: grid; grid-template-columns: 40px minmax(0, 1fr); align-items: start; gap: 6px 12px; }
  .cm-avatar{ grid-row: 1 / span 2; }
  .cm-tag{ grid-column: 2; justify-self: start; }
}

/* ---------- Phones: spacing follows the width of the screen, and long tables become short cards ---------- */
@media (max-width: 639px){
  .content{ padding: clamp(10px, 3.4vw, 16px) clamp(10px, 3.4vw, 16px) 18px; }
  .topbar{ min-height: 60px; padding: 8px 12px; }
  .adm-tabs{ margin-bottom: 12px; }
  .adm-h{ margin-top: 18px; }
  .site-content{ padding: 8px 14px 8px; }
  .sub-back{ margin-bottom: 2px; min-height: 32px; }
  .sub-head{ gap: 12px; margin-bottom: 14px; }
  .sub-head > div{ min-width: 0; flex: 1 1 160px; }
  .sub-head h1{ font-size: 24px; }
  .sub-head p{ font-size: 14.5px; }
  .sub-head .space-icon{ width: 48px; height: 48px; border-radius: 14px; }
  /* Tables of a few numbers (consent by society, biggest tables): a name, then the figures side by side */
  .adm-table.adm-compact:not(.adm-matrix) tr{ display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px 12px; padding: 10px 12px; }
  .adm-table.adm-compact:not(.adm-matrix) td, .adm-table.adm-compact:not(.adm-matrix) td[data-label]{ display: block; padding: 0; min-width: 0; }
  .adm-table.adm-compact:not(.adm-matrix) td[data-label]::before{ display: block; flex: none; margin-bottom: 1px; font-size: 10.5px; line-height: 1.25; }
  .adm-table.adm-compact:not(.adm-matrix) td:first-child{ grid-column: 1 / -1; padding-right: 0; font-size: 15px; }
  .adm-table.adm-compact:not(.adm-matrix) td:first-child::before{ display: none; }
}

@media (max-width: 639px){
  /* The public landing pages (Residents, Committee): the page already has its own side margin, so the inner block adds none, and less above */
  .sub-wrap{ padding: 4px 0 28px; }
}

/* ---------- What each service does: one card per service, in the colour of its tile ---------- */
.sub-about{ max-width: none; margin-top: 36px; }
.sub-about-lead{ margin: 0 0 14px; font-size: 14.5px; color: var(--text-muted); }
.svc-grid{ display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
@media (min-width: 640px){ .svc-grid{ grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1000px){ .svc-grid{ grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.svc{ display: flex; align-items: flex-start; gap: 14px; padding: 16px; background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--tile-a); border-radius: var(--radius-md, 12px); box-shadow: var(--shadow-sm); }
.svc-icon{ flex: 0 0 42px; width: 42px; height: 42px; display: inline-flex; align-items: center; justify-content: center; border-radius: 12px; background: var(--tile-base); color: var(--tile-fg); }
.svc-icon .icon{ width: 22px; height: 22px; }
.svc h3{ margin: 0 0 4px; font-size: 15.5px; line-height: 1.25; color: var(--text); }
.svc p{ margin: 0; font-size: 14px; line-height: 1.55; color: var(--text-muted); }
@media (max-width: 639px){ .sub-about{ margin-top: 28px; } .svc{ padding: 14px; gap: 12px; } }
