/* Owner dashboards (owners.html, owner.html). Built on styles.css: the header,
   tokens (--accent, --line ...), badges, buttons and .year-chart come from it. */

.dash-main {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 22px 18px 40px;
}

a.pill {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.pill--active {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.dash-intro h1,
.dash-title {
  margin: 0 0 6px;
  font-size: 26px;
  line-height: 1.15;
}

.dash-intro p {
  margin: 0 0 16px;
  color: var(--muted);
  max-width: 70ch;
  line-height: 1.5;
}

.dash-back {
  display: inline-block;
  margin-bottom: 10px;
  color: var(--accent);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
}

.dash-back:hover { text-decoration: underline; }

.dash-note { min-height: 16px; margin-bottom: 6px; }

.dash-footnote {
  margin: 12px 0 0;
  max-width: 90ch;
  line-height: 1.5;
}

.strong { font-weight: 700; }

/* ---- ranked list ---- */

.dash-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}

.dash-controls input[type="search"],
.dash-controls input[type="number"],
.dash-controls select,
.prop-controls input[type="search"],
.prop-controls select {
  font: inherit;
  font-size: 14px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
}

.dash-controls input[type="search"] { min-width: 260px; flex: 1 1 260px; }
.dash-controls input[type="number"] { width: 90px; }

.dash-controls label,
.prop-controls label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}

.dash-section--first { margin-top: 0; }

/* ---- Top owners bar chart ---- */

.top-chart-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  margin-bottom: 12px;
}

.top-chart-head h2 { margin: 0; }

.top-chart-head label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}

.top-chart-head select,
.dash-controls select {
  font: inherit;
  font-size: 14px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
}

.top-chart {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
}

.top-bar {
  display: grid;
  grid-template-columns: minmax(130px, 220px) 1fr 70px;
  align-items: center;
  gap: 12px;
  padding: 4px 0;
}

.top-bar__name {
  text-align: right;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.top-bar__name:hover { color: var(--accent); text-decoration: underline; }

.top-bar__track {
  height: 18px;
  background: var(--panel-soft);
  border-radius: 4px;
  overflow: hidden;
}

.top-bar__fill {
  height: 100%;
  min-width: 2px;
  border-radius: 4px;
}

.top-bar__value {
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* ---- ranking table, grouped columns ---- */

.dash-table--grouped thead th { border-bottom: 1px solid var(--line); }

.dash-table--grouped .group-head {
  text-align: center;
  font-size: 12px;
  color: var(--text);
  background: #eef3fb;
  border-left: 1px solid var(--line);
}

.dash-table--grouped .group-head--1 { background: #f6efe9; }

.dash-table--grouped .has-help { cursor: help; }
.dash-table--grouped .help-i { color: var(--muted); font-weight: 400; }

.dash-table--grouped .group-year {
  color: var(--muted);
  font-weight: 600;
}

/* A faint divider at the start of each group, so the groups read as blocks. */
.dash-table--grouped .leaf-row th:first-child,
.dash-table--grouped .leaf-row th.group-start { border-left: 1px solid var(--line); }
.dash-table--grouped td.group-start { border-left: 1px solid var(--line); }

.dash-table--grouped .group-col--1 { background-color: rgba(230, 126, 34, .035); }

.dash-glossary {
  margin-top: 18px;
  padding: 14px 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.dash-glossary h3 { margin: 0 0 8px; font-size: 14px; }
.dash-glossary dl { margin: 0 0 8px; display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; font-size: 13px; line-height: 1.45; }
.dash-glossary dt { font-weight: 700; }
.dash-glossary dd { margin: 0; color: var(--muted); }

.dash-table-wrap.is-loading { opacity: .55; transition: opacity .15s; }

@media (max-width: 700px) {
  .top-bar { grid-template-columns: 96px 1fr 52px; gap: 8px; }
  .dash-glossary dl { grid-template-columns: 1fr; }
}

.dash-table-wrap,
.prop-table-wrap {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow-x: auto;
}

.dash-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.dash-table th,
.dash-table td {
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
}

.dash-table thead th {
  position: sticky;
  top: 0;
  background: #f8fbff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  z-index: 1;
}

.dash-table tbody tr:last-child td { border-bottom: 0; }
.dash-table tbody tr:hover { background: var(--panel-soft); }

.dash-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.dash-table .rank { width: 36px; color: var(--muted); text-align: right; }
.dash-table .owner-name a { color: var(--accent); font-weight: 700; text-decoration: none; }
.dash-table .owner-name a:hover { text-decoration: underline; }
.dash-table .is-sorted { color: var(--text); }

.dash-sort {
  all: unset;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
}
.dash-sort:hover { color: var(--accent); }
.dash-sort:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.dash-table--compact th,
.dash-table--compact td { padding: 8px 10px; }

.dash-table tr.is-selected { background: var(--accent-soft); }

.dash-pager {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 2px 0;
}

.dash-pager .sub { margin-right: auto; }
.dash-pager .filter-btn[disabled] { opacity: .45; cursor: default; }

/* ---- owner page ---- */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 12px;
  margin: 18px 0 8px;
}

.kpi {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  box-shadow: 0 1px 3px rgba(16, 24, 40, .03);
}

.kpi__value {
  font-size: 26px;
  font-weight: 800;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.kpi__label {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}

.kpi__note {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}

.dash-section { margin-top: 28px; }

.dash-section h2 {
  margin: 0 0 12px;
  font-size: 18px;
}

/* A short line under a section heading explaining how its numbers are counted. */
.dash-lede {
  margin: -4px 0 14px;
  max-width: 90ch;
  line-height: 1.5;
}

/* Tenant outcomes: one card per outcome, holding its own numbers and chart. */
.outcome-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 14px;
}

.outcome-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 1px 3px rgba(16, 24, 40, .03);
}

.outcome-card h3 { margin: 0 0 12px; font-size: 15px; }
.outcome-card .kpi-grid { margin: 0 0 14px; }
.outcome-card .year-chart { margin: 0; border: 0; padding: 0; }

/* Smaller tiles for inside a card or a short row. */
.kpi-grid--compact {
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  margin: 0 0 14px;
}

.kpi-grid--compact .kpi {
  padding: 10px 12px;
  background: var(--panel-soft);
  box-shadow: none;
}

.kpi-grid--compact .kpi__value { font-size: 22px; }
/* Long figures (e.g. $478,928,170) shrink to stay inside the tile. */
.kpi .kpi__value--long { font-size: 21px; }

#managedTable { margin-top: 12px; }

.prop-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}

.prop-controls input[type="search"] { flex: 1 1 260px; min-width: 220px; }
.prop-controls .check input { margin: 0; }

.prop-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.prop-table-wrap { max-height: 560px; overflow-y: auto; }
.prop-table-wrap--tall { max-height: 460px; }
.prop-table-wrap .dash-table tbody tr { cursor: pointer; }

.prop-map {
  height: 560px;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  position: sticky;
  top: 84px;
}

/* ---- map: owned (circles) vs managed (diamonds) + legend ---- */

.dotted-marker { background: none; border: 0; }

/* Managed properties: same size scale and colors as owned, but polka-dotted. */
.dotted-marker div,
.map-legend .dot--dotted {
  border-radius: 50%;
  border: 1.5px solid #fff;
  box-shadow: 0 0 0 1px rgba(16, 24, 40, .35);
  background-image: radial-gradient(circle, rgba(255, 255, 255, .95) 0 1.6px, transparent 2px);
  background-size: 6px 6px;
  box-sizing: border-box;
}

.map-legend {
  background: rgba(255, 255, 255, .95);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.35;
  color: var(--text);
  max-width: 250px;
  box-shadow: 0 1px 4px rgba(16, 24, 40, .12);
}

.map-legend__title { font-weight: 700; margin-bottom: 4px; }

.map-legend__row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 3px 0;
  cursor: pointer;
}

.map-legend__row[hidden] { display: none; }
.map-legend__row input { margin: 0; }
.map-legend__dots { display: inline-flex; gap: 2px; align-items: center; min-width: 40px; }
.map-legend .dot { width: 11px; height: 11px; border-radius: 50%; display: inline-block; background: #667085; border: 1.5px solid #fff; box-shadow: 0 0 0 1px rgba(16, 24, 40, .35); }

.map-legend__hint { color: var(--muted); font-size: 11px; margin: 0 0 4px 22px; }

/* On a phone the map is small: keep the key short. */
@media (max-width: 700px) {
  .map-legend { max-width: 190px; padding: 5px 7px; font-size: 11px; }
  .map-legend__hint { display: none; }
  .map-legend__dots { min-width: 0; }
}

.managed-title { margin: 6px 0 4px; font-size: 15px; }
#managedTable .prop-table-wrap .dash-table tbody tr { cursor: pointer; }

.dash-section details summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 8px;
}

@media (max-width: 860px) {
  .prop-layout { grid-template-columns: 1fr; }
  .prop-map { position: static; height: 360px; order: -1; }
  .prop-table-wrap { max-height: 480px; }
  .dash-controls input[type="search"] { min-width: 0; }
}

/* Subsidies: small horizontal bar lists. */
.mini-bars { display: grid; gap: 6px; }
.mini-bar { display: grid; grid-template-columns: minmax(90px, 40%) 1fr auto; align-items: center; gap: 8px; font-size: 13px; }
.mini-bar__label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-bar__track { height: 10px; background: #eef1f6; border-radius: 5px; overflow: hidden; }
.mini-bar__track i { display: block; height: 100%; background: #1f9d63; border-radius: 5px; }
.mini-bar__n { font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---- Zip code page ---- */
.zip-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 14px;
  align-items: stretch;
}

.zip-map {
  height: auto;
  min-height: 520px;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}

.zip-detail {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  min-height: 200px;
}

.zip-detail__title { margin: 0 0 10px; font-size: 22px; }

@media (max-width: 900px) {
  .zip-layout { grid-template-columns: 1fr; }
  .zip-map { height: 380px; }
}

.zip-detail__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 14px;
  margin-bottom: 12px;
}

.zip-pick {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--muted);
}

.zip-pick select {
  font: inherit;
  font-size: 20px;
  font-weight: 800;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
}

/* Header navigation buttons for the dashboard pages, in the logo's green. */
.nav-btn {
  display: inline-block;
  padding: 11px 22px;
  border: 1px solid #078f77;
  border-radius: 12px;
  background: #0aa68a;
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  text-decoration: none;
  transition: background .15s ease, box-shadow .15s ease;
}

.nav-btn:hover { background: #078f77; }
.nav-btn:visited { color: #fff; }

/* Same green either way; the current page gets a ring. */
.nav-btn--active { box-shadow: 0 0 0 3px rgba(10, 166, 138, .32); }

.app-header .controls { gap: 10px; }

/* Dashboard toggle: same green pill as the registry's search-by toggle. */
.app-header .mode-toggle .tab { display: inline-block; text-decoration: none; font-size: 14px; }
.app-header .controls .dash-cta--header { padding: 10px 18px; font-size: 15px; border-radius: 12px; white-space: nowrap; }

.zip-prop-table { max-height: 520px; overflow-y: auto; }
.zip-prop-table tbody tr { cursor: pointer; }
.zip-detail:has(.zip-prop-table) { padding: 0; overflow: hidden; }

/* County-wide: the 5 worst zips beside the map. */
.zip-rank-title { margin: 0 0 8px; font-size: 14px; }
.zip-rank-title:not(:first-child) { margin-top: 18px; }
.zip-rank-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; counter-reset: zr; }
.zip-rank-list li { counter-increment: zr; }

.zip-rank-item {
  all: unset;
  box-sizing: border-box;
  width: 100%;
  display: grid;
  grid-template-columns: 26px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-soft);
  cursor: pointer;
  font-size: 14px;
}

.zip-rank-item::before {
  content: counter(zr);
  color: var(--muted);
  font-weight: 700;
}

.zip-rank-item:hover { border-color: rgba(46, 106, 215, .5); background: var(--accent-soft); }
.zip-rank-item__zip { font-weight: 800; }
.zip-rank-item__n { font-weight: 700; font-variant-numeric: tabular-nums; }

/* Property card under the table on the owner page. */
.prop-left { display: grid; gap: 14px; align-content: start; min-width: 0; }
.prop-card { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.prop-card__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 8px; }
.prop-card__title { font-weight: 800; font-size: 16px; }
.prop-card .kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; font-size: 13px; line-height: 1.4; }
.prop-card .kv .k { color: var(--muted); }
.prop-card__note { margin-top: 10px; }

/* County zip choropleth legend. */
.zip-legend { background: rgba(255,255,255,.94); padding: 8px 10px; border-radius: 10px; box-shadow: 0 1px 6px rgba(0,0,0,.2); font-size: 12px; min-width: 150px; }
.zip-legend__title { font-weight: 700; margin-bottom: 4px; }
.zip-legend__bar { height: 10px; border-radius: 5px; border: 1px solid #d5dbe5; }
.zip-legend__labels { display: flex; justify-content: space-between; margin-top: 2px; color: #475569; }
