/* =========================================================================
   HSCP design system.
   Palette is grounded in the Leon County seal (navy #284361 + gold #c8a24a),
   matching the legacy application's primary blue. Semantic status colors
   (success / warning / danger) are kept separate from the brand accent so
   color always carries meaning. All text/background pairs meet WCAG 2.1 AA.
   ========================================================================= */

:root {
  --navy: #284361;         /* legacy primary blue (brand) */
  --navy-deep: #1c3247;    /* banner depth / hover */
  --navy-ink: #16283a;     /* headings */
  --link: #2f5d8a;         /* accessible link blue on white (>4.5:1) */
  --gold: #c8a24a;         /* Leon seal gold — accent, used sparingly */
  --gold-light: #e0c274;
  --ground: #eef2f6;       /* cool light page ground */
  --card: #ffffff;
  --border: #dbe2ea;
  --border-strong: #c3ceda;
  --tint: #eef3f8;         /* section-header tint */
  --ink: #1f2a37;
  --muted: #5b6b7d;
  --radius: 0.375rem;
  --shadow: 0 1px 2px rgba(22,40,58,.06), 0 1px 3px rgba(22,40,58,.08);
}

html {
  font-size: 14px;
  position: relative;
  min-height: 100%;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

body {
  margin-bottom: 60px;
  background-color: var(--ground);
  color: var(--ink);
}

h1, h2, h3 {
  text-wrap: balance;
  color: var(--navy-ink);
}

/* General in-content links (specific overrides for the navy header / table
   headers below win by specificity). */
main a {
  color: var(--link);
}

/* =========================================================================
   Icons — inline line icons (see Pages/Shared/_IconSprite.cshtml). Decorative
   only (aria-hidden); every icon sits beside a text label. Stroke inherits the
   surrounding text color so icons pick up nav/tile palette automatically.
   ========================================================================= */
.hscp-icon {
  width: 1.15em;
  height: 1.15em;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: -0.18em;
}

/* --- Accessibility (WCAG 2.1 AA baseline) --- */

/* Skip link: visually hidden until focused, then visible on screen. */
.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  z-index: 1100;
  padding: 0.5rem 1rem;
  background: var(--navy);
  color: #fff;
  text-decoration: none;
}
.skip-link:focus {
  left: 0;
}

/* Visible keyboard focus everywhere (don't suppress outlines). Navy against the
   light page background (≥3:1 — WCAG 1.4.11); gold stays where the backdrop is
   the navy header. */
a:focus-visible,
button:focus-visible,
.form-control:focus-visible,
.form-select:focus-visible,
.nav-link:focus-visible {
  outline: 3px solid var(--navy);
  outline-offset: 2px;
}

/* The skip-link target receives focus programmatically (not via keyboard tab),
   so it should not paint a page-wide focus ring around all content. */
#main-content:focus { outline: none; }

.hscp-brandbar a:focus-visible,
.hscp-brandbar button:focus-visible,
.hscp-mainnav a:focus-visible,
.hscp-mainnav button:focus-visible {
  outline-color: var(--gold);
}

.btn:focus, .btn:active:focus, .form-control:focus, .form-select:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem #fff, 0 0 0 0.25rem var(--navy);
}

/* Required-field marker (WCAG 3.3.2): AriaValidationTagHelpers appends this to
   the label of every [Required]-annotated control; aria-required on the control
   is the programmatic pair. */
.hscp-required {
  color: #b32d2e;
  font-weight: 700;
}

/* Form/content width clamps. */
.hscp-mw-40 { max-width: 40rem; }
.hscp-mw-48 { max-width: 48rem; }
.hscp-mw-56 { max-width: 56rem; }
.hscp-mw-60 { max-width: 60rem; }

/* =========================================================================
   Two-tier brand header (seal + title banner, gold rule, module nav row).
   ========================================================================= */
.hscp-brandbar {
  background: linear-gradient(180deg, var(--navy) 0%, var(--navy-deep) 100%);
  color: #fff;
  box-shadow: 0 2px 6px rgba(22,40,58,.18);
}
.hscp-brandbar .container {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  padding-top: 0.7rem;
  padding-bottom: 0.7rem;
}
.hscp-seal {
  width: 3.4rem;
  height: 3.4rem;
  flex: none;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,.35));
}
.hscp-brand-link {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  text-decoration: none;
  color: #fff;
}
.hscp-brand-link:hover { color: #fff; }
.hscp-brand-text { display: flex; flex-direction: column; }
.hscp-brand-title {
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.1;
}
.hscp-brand-sub {
  font-size: 0.8rem;
  color: #cdd9e6;
  margin-top: 0.1rem;
}
.hscp-brand-user {
  margin-left: auto;
  text-align: right;
  font-size: 0.82rem;
  color: #cdd9e6;
  line-height: 1.4;
}
.hscp-brand-user strong { color: #fff; font-weight: 600; }
.hscp-brand-user .btn-link {
  color: var(--gold);
  padding: 0;
  vertical-align: baseline;
  text-decoration: none;
  font-size: 0.82rem;
}
.hscp-brand-user .btn-link:hover { color: var(--gold-light); text-decoration: underline; }

/* Gold rule tying the header to the county seal. */
.hscp-goldrule {
  height: 3px;
  background: linear-gradient(90deg, var(--gold), var(--gold-light));
}

/* Module nav row. */
.hscp-mainnav {
  background: var(--navy-deep);
}
.hscp-mainnav .navbar-nav { flex-direction: row; flex-wrap: wrap; }
.hscp-mainnav .nav-link {
  color: #d5e0ec;
  font-size: 0.92rem;
  padding: 0.7rem 0.9rem;
  border-bottom: 3px solid transparent;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}
/* Nav icons ride slightly dimmer than the label until hover/active, so the
   text stays the primary read. */
.hscp-mainnav .nav-link .hscp-icon { opacity: 0.85; }
.hscp-mainnav .nav-link:hover .hscp-icon,
.hscp-mainnav .nav-link:focus .hscp-icon,
.hscp-mainnav .nav-link[aria-current="page"] .hscp-icon { opacity: 1; }
.hscp-mainnav .nav-link:hover,
.hscp-mainnav .nav-link:focus {
  color: #fff;
  background: rgba(255,255,255,.06);
}
.hscp-mainnav .nav-link[aria-current="page"] {
  color: #fff;
  font-weight: 600;
  border-bottom-color: var(--gold);
}
.hscp-mainnav .navbar-toggler {
  border-color: rgba(255,255,255,.35);
}

.footer {
  position: absolute;
  bottom: 0;
  width: 100%;
  white-space: nowrap;
  line-height: 60px;
  background: var(--ground);
}

/* =========================================================================
   Buttons — recolor Bootstrap's variants to the HSCP brand.
   ========================================================================= */
.btn-primary {
  --bs-btn-bg: var(--navy);
  --bs-btn-border-color: var(--navy);
  --bs-btn-hover-bg: var(--navy-deep);
  --bs-btn-hover-border-color: var(--navy-deep);
  --bs-btn-active-bg: var(--navy-deep);
  --bs-btn-active-border-color: var(--navy-deep);
  --bs-btn-disabled-bg: var(--navy);
  --bs-btn-disabled-border-color: var(--navy);
}
.btn-outline-primary {
  --bs-btn-color: var(--navy);
  --bs-btn-border-color: var(--border-strong);
  --bs-btn-hover-bg: var(--tint);
  --bs-btn-hover-color: var(--navy-deep);
  --bs-btn-hover-border-color: var(--navy);
  --bs-btn-active-bg: var(--navy);
  --bs-btn-active-border-color: var(--navy);
}
.btn-outline-secondary {
  --bs-btn-color: var(--navy);
  --bs-btn-border-color: var(--border-strong);
  --bs-btn-hover-bg: var(--tint);
  --bs-btn-hover-color: var(--navy-deep);
  --bs-btn-hover-border-color: var(--border-strong);
}

/* =========================================================================
   Cards — add subtle depth to Bootstrap cards.
   ========================================================================= */
.card {
  border-color: var(--border);
  box-shadow: var(--shadow);
}

/* Sub-nav pills (Clients business-area filter). Global (NOT in the scoped
   _Layout.cshtml.css, whose isolation would never reach page markup) so the
   Clients pills render in brand navy instead of Bootstrap's default blue. */
.nav-pills .nav-link { color: var(--navy); }
.nav-pills .nav-link:hover { background-color: var(--tint); }
.nav-pills .nav-link.active,
.nav-pills .show > .nav-link {
  color: #fff;
  background-color: var(--navy);
}

/* Page header (title + optional subtitle + actions). */
.hscp-page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 0.25rem 0 1rem;
}
.hscp-page-head .hscp-sub {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0.15rem 0 0;
}

/* =========================================================================
   Detail "hero" header card (client name + meta + actions).
   ========================================================================= */
.hscp-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.9rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 5px solid var(--navy);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.1rem 1.35rem;
  margin-bottom: 1.25rem;
}
.hscp-hero h1 { margin: 0; font-size: 1.7rem; }
.hscp-hero .hscp-hero-meta {
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 0.3rem;
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}
.hscp-hero .hscp-hero-actions { display: flex; gap: 0.5rem; }

/* =========================================================================
   Section cards (detail-screen field groups).
   ========================================================================= */
.hscp-sec {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  height: 100%;
}
.hscp-sec > h2 {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--navy);
  background: var(--tint);
  border-bottom: 1px solid var(--border);
  padding: 0.6rem 1rem;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.hscp-sec > h2::before {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 2px;
  background: var(--gold);
  flex: none;
}
.hscp-sec dl {
  margin: 0;
  padding: 0.35rem 1rem 0.75rem;
  display: grid;
  grid-template-columns: 44% 56%;
}
.hscp-sec dt {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 400;
  padding: 0.4rem 0.5rem 0.4rem 0;
  border-bottom: 1px solid #f0f3f6;
}
.hscp-sec dd {
  margin: 0;
  font-size: 0.9rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid #f0f3f6;
}
.hscp-sec dl > dt:last-of-type,
.hscp-sec dl > dd:last-of-type { border-bottom: 0; }

/* =========================================================================
   Form section cards (edit-screen field groups) — the fieldset counterpart of
   .hscp-sec, so edit forms get the same tinted header bar + gold marker that
   separates sections on the detail screens.
   ========================================================================= */
.hscp-formsec {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 1.25rem;
}
.hscp-formsec > legend {
  float: none;            /* undo Bootstrap's legend float so it renders as a header bar */
  width: 100%;
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--navy);
  background: var(--tint);
  border-bottom: 1px solid var(--border);
  padding: 0.6rem 1rem;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.hscp-formsec > legend::before {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 2px;
  background: var(--gold);
  flex: none;
}
.hscp-formsec-body {
  padding: 1rem 1rem 0.25rem;
}

/* =========================================================================
   Dashboard stat tiles.
   ========================================================================= */
.hscp-stat {
  background: var(--card);
  border: 1px solid var(--border);
  border-top: 3px solid var(--gold);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem 1.15rem;
  height: 100%;
}
.hscp-stat .hscp-stat-k {
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.hscp-stat .hscp-stat-v {
  font-size: 2rem;
  font-weight: 700;
  color: var(--navy);
  line-height: 1.1;
  margin-top: 0.35rem;
  font-variant-numeric: tabular-nums;
}
.hscp-stat .hscp-stat-d {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 0.25rem;
}

/* =========================================================================
   Client detail tabs (Demographics / Household / Financial / Services / Comms).
   ========================================================================= */
.hscp-client-tabs {
  border-bottom: 2px solid var(--border-strong);
  gap: 0.15rem;
  flex-wrap: wrap;
}
.hscp-client-tabs .nav-link {
  color: var(--muted);
  font-weight: 600;
  border: 0;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  margin-bottom: -2px;
  padding: 0.6rem 1rem;
  background: none;
}
.hscp-client-tabs .nav-link:hover {
  color: var(--navy);
  border-bottom-color: var(--border-strong);
}
.hscp-client-tabs .nav-link.active {
  color: var(--navy-ink);
  background: none;
  border-bottom-color: var(--navy);
}
.hscp-client-tabs .hscp-tab-count {
  display: inline-block;
  min-width: 1.4rem;
  padding: 0 0.35rem;
  margin-left: 0.3rem;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.4rem;
  text-align: center;
  color: var(--navy);
  background: var(--tint);
  border-radius: 0.75rem;
}
.hscp-client-tabs .nav-link.active .hscp-tab-count {
  color: #fff;
  background: var(--navy);
}
.hscp-client-tabpanels {
  padding-top: 1.25rem;
}

/* Home module tiles (full-card links). */
.hscp-tile {
  display: block;
  text-decoration: none;
  color: inherit;
  background: var(--card);
  border: 1px solid var(--border);
  border-top: 3px solid var(--gold);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.1rem 1.25rem;
  height: 100%;
  transition: box-shadow .12s ease, transform .12s ease;
}
.hscp-tile:hover,
.hscp-tile:focus-visible {
  box-shadow: 0 4px 12px rgba(22,40,58,.14);
  transform: translateY(-2px);
  color: inherit;
}
.hscp-tile .hscp-tile-head {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}
.hscp-tile .hscp-tile-icon {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: var(--radius);
  color: var(--navy);
  background: var(--tint);
  border: 1px solid var(--border);
}
.hscp-tile .hscp-tile-icon .hscp-icon { width: 1.4rem; height: 1.4rem; }
.hscp-tile:hover .hscp-tile-icon,
.hscp-tile:focus-visible .hscp-tile-icon {
  color: #fff;
  background: var(--navy);
  border-color: var(--navy);
}
.hscp-tile .hscp-tile-t { font-size: 1.1rem; font-weight: 700; color: var(--navy); }
.hscp-tile .hscp-tile-d { font-size: 0.85rem; color: var(--muted); margin-top: 0.7rem; }
@media (prefers-reduced-motion: reduce) {
  .hscp-tile { transition: none; }
  .hscp-tile:hover, .hscp-tile:focus-visible { transform: none; }
}

/* Row-level icon actions (the Edit / Delete columns in data tables — legacy used
   icon-only grid actions). Icon-only, so each carries a visually-hidden label and
   a title tooltip; color pairs meet WCAG AA on the row backgrounds. */
.hscp-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.15rem 0.3rem;
  border: 0;
  border-radius: var(--radius);
  background: none;
  color: var(--link);
}
.hscp-action:hover,
.hscp-action:focus-visible {
  background: var(--tint);
  color: var(--navy-deep);
}
.hscp-action .hscp-icon {
  width: 1.2em;
  height: 1.2em;
  vertical-align: -0.25em;
}
.hscp-action--danger { color: #b32d2e; }
.hscp-action--danger:hover,
.hscp-action--danger:focus-visible {
  background: #fbeaea;
  color: #8a2122;
}

/* Status pills with text (not color alone). */
.status-pill {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border-radius: 0.75rem;
  font-size: 0.8rem;
  border: 1px solid #495057;
}
.status-pill.is-active { border-color: #1a7d3c; color: #14632f; background: #eaf6ee; }
.status-pill.is-inactive { border-color: #6c757d; color: #495057; background: #f1f3f5; }
.status-pill.is-locked { border-color: #b32d2e; color: #8a2122; background: #fbeaea; }

/* --- Data list tables --- */
.hscp-table {
  width: 100%;
  margin-bottom: 0;
}
.hscp-table > thead > tr > th {
  background-color: var(--navy);
  color: #fff;
  vertical-align: bottom;
  border-bottom: 3px solid var(--navy-deep);
  padding: 0.6rem 0.75rem;
  white-space: nowrap;
}
.hscp-table > thead > tr > th a {
  color: #fff;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}
.hscp-table > thead > tr > th a:hover,
.hscp-table > thead > tr > th a:focus-visible {
  color: var(--gold-light);
  text-decoration: underline;
}
.hscp-table > thead > tr > th[aria-sort="ascending"] a,
.hscp-table > thead > tr > th[aria-sort="descending"] a {
  font-weight: 700;
  color: var(--gold-light);
}
.hscp-table > tbody > tr > td {
  padding: 0.55rem 0.75rem;
  vertical-align: middle;
  border-top: 1px solid #e3e6ea;
}
.hscp-table > tbody > tr:nth-of-type(odd) > td {
  background-color: #f7f9fc;
}
.hscp-table > tbody > tr:hover > td {
  background-color: #eaf0fa;
}
/* Rounded, bordered wrapper that still scrolls wide tables horizontally.
   overflow-x:auto (not overflow:hidden) so many-column tables like the client
   list don't clip their right-hand columns; the rounded corners still clip. */
.table-responsive.hscp-table-wrap {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  overflow-x: auto;
  box-shadow: var(--shadow);
  background: var(--card);
}

/* Multi-select dropdown filter (toggle + searchable checkable panel). */
.hscp-ms-menu {
  min-width: 14rem;
}
.hscp-ms-options {
  max-height: 14rem;
  overflow-y: auto;
}
.hscp-ms-option {
  padding-block: 0.1rem;
}
.hscp-ms-toggle .hscp-ms-summary {
  min-width: 0; /* let the summary truncate instead of pushing the caret out */
}

/* Grouped variant: one client spans several service rows (rowspan identity
   cells), so we shade per client block rather than per row and divide clients
   with a stronger border. */
.hscp-table--grouped > tbody > tr:nth-of-type(odd) > td { background-color: transparent; }
.hscp-table--grouped > tbody > tr.client-alt > td { background-color: #f7f9fc; }
.hscp-table--grouped > tbody > tr.client-start > td { border-top: 2px solid #cdd6e0; }
.hscp-table--grouped > tbody > tr:first-child.client-start > td { border-top: 0; }
.hscp-table--grouped > tbody > tr:hover > td { background-color: #eaf0fa; }
