/* Connected Home Outfitters brand — colors/fonts pulled from the WordPress site's
   Elementor global kit (see CLAUDE.md "Common Gotchas" #9). Applies sitewide (staff
   admin + customer portal) so both share one identity; views/portal/*.ejs layer
   portal.css on top for the customer-facing header/logo treatment specifically. */

:root {
  --cho-accent: #0799D6;   /* Elementor "Accent" — primary buttons/links */
  --cho-primary: #6EC1E4;  /* Elementor "Primary" — lighter accent */
  --cho-dark: #54595F;     /* Elementor "Secondary" — headings */
  --cho-text: #7A7A7A;     /* Elementor "Text" — body copy */

  --bs-primary: var(--cho-accent);
  --bs-primary-rgb: 7, 153, 214;
  --bs-link-color: var(--cho-accent);
  --bs-link-color-rgb: 7, 153, 214;
  --bs-link-hover-color: #067bb0;
  --bs-link-hover-color-rgb: 6, 123, 176;
}

body {
  background-color: #f8f9fa;
  font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
}

/* !important because these override a precompiled, unmodified vendor bootstrap.min.css
   (see gotcha #7 — self-hosted but not recompiled from our own SCSS), so CSS variable
   inheritance alone doesn't reach every component that hardcodes the default blue. */
.btn-primary {
  background-color: var(--cho-accent) !important;
  border-color: var(--cho-accent) !important;
}
.btn-primary:hover,
.btn-primary:focus {
  background-color: var(--bs-link-hover-color) !important;
  border-color: var(--bs-link-hover-color) !important;
}
.btn-outline-primary {
  color: var(--cho-accent) !important;
  border-color: var(--cho-accent) !important;
}
.btn-outline-primary:hover {
  background-color: var(--cho-accent) !important;
  border-color: var(--cho-accent) !important;
}
.text-primary { color: var(--cho-accent) !important; }
.bg-primary { background-color: var(--cho-accent) !important; }
.border-primary { border-color: var(--cho-accent) !important; }

.navbar .nav-link:hover,
.navbar .nav-link:focus {
  color: var(--cho-accent) !important;
}

/* --- Admin nav: fixed left sidebar on desktop, offcanvas (hamburger) on mobile ---
   The sidebar element is always in the DOM (display:none below lg via Bootstrap's
   d-none/d-lg-flex), so body:has(.cho-sidebar) reliably detects "this is an admin page"
   and offsets the content — but only inside the lg+ media query, so mobile keeps the
   full-width top bar + offcanvas instead. Portal/login pages don't include nav.ejs, so
   they never get the offset. */
.cho-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 220px;
  background: #fff;
  border-right: 1px solid #e5e7eb;
  padding: 1rem 0.75rem;
  overflow-y: auto;
  z-index: 1030;
}
.cho-brand {
  display: block;
  padding: 0.25rem 0.5rem 1rem;
}
.cho-brand img {
  max-width: 100%;
  height: 34px;
}
.cho-nav {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.cho-nav-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  color: var(--cho-dark);
  text-decoration: none;
  font-size: 0.95rem;
  white-space: nowrap;
}
.cho-nav-link i {
  font-size: 1.05rem;
  opacity: 0.85;
}
.cho-nav-link:hover,
.cho-nav-link:focus {
  background: rgba(7, 153, 214, 0.08);
  color: var(--cho-accent);
}
.cho-nav-link.active {
  background: var(--cho-accent);
  color: #fff;
}
.cho-nav-link.active i {
  opacity: 1;
}
/* Cross-product link back to Connected Home Ledger. Deliberately quieter than the real
   nav items — it leaves this app, so it shouldn't compete with the sections inside it. */
.cho-nav-sep {
  border-top: 1px solid #eee;
  margin: 0.5rem 0.25rem;
}
.cho-nav-ext {
  color: var(--cho-muted, #7A7A7A);
  font-size: 0.9rem;
}
.cho-nav-ext i {
  font-size: 0.9rem;
}
.cho-logout {
  padding-top: 0.75rem;
  margin-top: 0.5rem;
  border-top: 1px solid #eee;
}
.cho-offcanvas {
  max-width: 78vw;
}

@media (min-width: 992px) {
  body:has(.cho-sidebar) {
    padding-left: 220px;
    padding-top: 1.5rem;
  }
}

/* --- Scheduling calendar (views/admin/calendar.ejs) --- */
.cho-cal {
  width: 100%;
  min-width: 780px;
  table-layout: fixed;
  border-collapse: collapse;
  background: #fff;
}
.cho-cal th {
  text-align: left;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--cho-dark);
  padding: 6px 8px;
  border: 1px solid #e5e7eb;
  background: #f8f9fa;
}
.cho-cal td {
  vertical-align: top;
  height: 96px;
  width: 14.28%;
  border: 1px solid #e5e7eb;
  padding: 4px;
}
.cho-cal-out { background: #fafbfc; }
.cho-cal-out .cho-cal-daynum { color: #c0c4c9; }
.cho-cal-today { background: rgba(7, 153, 214, 0.06); }
.cho-cal-today .cho-cal-daynum {
  background: var(--cho-accent);
  color: #fff;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  text-align: center;
  line-height: 22px;
}
.cho-cal-daynum {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--cho-dark);
  margin-bottom: 3px;
}
.cho-cal-ev {
  display: block;
  font-size: 0.72rem;
  line-height: 1.25;
  padding: 2px 5px;
  margin-bottom: 2px;
  border-radius: 4px;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cho-cal-ev .cho-cal-time { font-weight: 600; opacity: 0.85; }
.cho-ev-consultation { background: #cfe8f7; color: #084c74; }
.cho-ev-install      { background: var(--cho-accent); color: #fff; }
.cho-ev-followup     { background: #fff3cd; color: #664d03; }
/* Recurring service visits. Always set colour alongside background here — an unpaired
   background inherits whatever the surrounding text colour is and goes low-contrast. */
.cho-ev-service      { background: #d4edda; color: #0f5132; }
.cho-ev-other        { background: #e2e3e5; color: #41464b; }
.cho-ev-due          { background: #fff; color: #6c757d; border: 1px dashed #adb5bd; }

/* ── First-run setup checklist (dashboard card + /welcome) ────────────────────
   Shared by both surfaces so they can't drift. Quiet by design: it is scaffolding
   a tenant should stop seeing, not a permanent feature of the dashboard. */
.cho-setup__count { font-size: .8rem; color: var(--cho-muted, #7A7A7A); }
.cho-setup__bar {
  height: 4px; border-radius: 2px; background: #e9eef2; overflow: hidden; margin-bottom: 1rem;
}
.cho-setup__bar span { display: block; height: 100%; background: var(--cho-accent); transition: width .3s ease; }

.cho-setup__list { list-style: none; margin: 0; padding: 0; }
.cho-setup__item {
  display: flex; align-items: flex-start; gap: .75rem;
  padding: .8rem 0; border-top: 1px solid #eef2f5;
}
.cho-setup__item:first-child { border-top: 0; }
.cho-setup__item > i { font-size: 1.1rem; line-height: 1.4; color: #c3ced6; flex: 0 0 auto; }
.cho-setup__item.is-done > i { color: #1a9e63; }
.cho-setup__item.is-done .cho-setup__title { color: var(--cho-muted, #7A7A7A); text-decoration: line-through; }
.cho-setup__item.is-done .cho-setup__body { display: none; }

.cho-setup__text { flex: 1 1 auto; min-width: 0; }
.cho-setup__title { display: block; font-weight: 600; font-size: .95rem; }
.cho-setup__body { display: block; font-size: .85rem; color: var(--cho-muted, #7A7A7A); margin-top: .15rem; }
.cho-setup__item .btn { flex: 0 0 auto; align-self: center; }

.cho-setup__opt, .cho-setup__block {
  display: inline-block; margin-left: .4rem; padding: .05rem .4rem; border-radius: 3px;
  font-size: .68rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em;
  vertical-align: middle;
}
.cho-setup__opt   { background: #eef2f5; color: #7A7A7A; }
/* "blocks payments" is the only genuinely urgent state here, so it is the only one that
   gets a warning colour. */
.cho-setup__block { background: #fdecea; color: #b3261e; }

.cho-welcome__flow { margin: 0; padding-left: 1.15rem; }
.cho-welcome__flow li { margin-bottom: .4rem; font-size: .95rem; }
.cho-welcome__flow li:last-child { margin-bottom: 0; }

/* ── Searchable customer picker (views/partials/customer-picker.ejs) ──────────
   Always set colour alongside background here: an unpaired background inherits the
   surrounding text colour and goes low-contrast, which is exactly how the light-on-light
   bug on the marketing site happened. */
.cho-picker { position: relative; }
.cho-picker-results {
  position: absolute; z-index: 1050; top: 100%; left: 0; right: 0;
  margin: 2px 0 0; padding: 4px 0; list-style: none;
  max-height: 280px; overflow-y: auto;
  background: #fff; color: #212529;
  border: 1px solid #ced4da; border-radius: .375rem;
  box-shadow: 0 .5rem 1rem rgba(0,0,0,.15);
}
.cho-picker-item {
  display: flex; flex-direction: column; gap: 1px;
  padding: .35rem .75rem; cursor: pointer;
  background: #fff; color: #212529;
}
.cho-picker-item:hover, .cho-picker-item.active { background: var(--cho-accent); color: #fff; }
.cho-picker-item.active .cho-picker-meta, .cho-picker-item:hover .cho-picker-meta { color: #eaf6fd; }
.cho-picker-name { font-weight: 500; }
.cho-picker-meta { font-size: .8125rem; color: #6c757d; }
.cho-picker-empty { padding: .35rem .75rem; color: #6c757d; font-size: .875rem; }

/* Sortable table headers (customers list). Colour is set explicitly alongside every
   state — an unpaired rule here inherits the surrounding text colour and the active
   header stops being distinguishable from the inactive ones. */
.cho-th-sort { color: var(--cho-dark); text-decoration: none; white-space: nowrap; }
.cho-th-sort:hover { color: var(--cho-accent); text-decoration: underline; }
.cho-th-sort.active { color: var(--cho-accent); }
.cho-th-sort i { font-size: .7rem; }
