/* ==========================================================================
   Portman theme
   Derived from the "IT Portfolio Dashboard" design (design/IT Portfolio
   Dashboard.html) — a dark sidebar + light content shell, Space Grotesk
   type, and a warm-neutral gray palette with green/amber/red status colors.
   ========================================================================== */

:root {
  /* Ink / text */
  --ink: #141619;
  --ink-2: #5a616b;
  --ink-3: #8b929c;
  --ink-4: #a2a8b1;

  /* Surfaces */
  --bg: #f5f6f8;
  --surface: #fff;
  --surface-alt: #fafbfc;
  --surface-hover: #f7f8fa;
  --surface-sunken: #f0f1f3;

  /* Borders */
  --border: #eceef1;
  --border-strong: #e6e8ec;
  --border-soft: #f4f5f7;

  /* Accent */
  --accent: #2a6fd6;
  --accent-hover: #1c58b0;
  --accent-soft: #eaf2fe;

  /* Sidebar */
  --sidebar-bg: #141619;
  --sidebar-panel: #1c2028;
  --sidebar-input: #242832;
  --sidebar-border: #333947;
  --sidebar-text: #c9ccd2;
  --sidebar-muted: #7a808b;
  --sidebar-muted-2: #6b717b;

  /* Status */
  --green: #1f8f56;
  --green-soft: #eafaf0;
  --amber: #c07d10;
  --amber-soft: #fef4e2;
  --red: #d33d31;
  --red-soft: #fbeceb;
  --red-border: #f3d3d0;

  --radius-sm: 7px;
  --radius: 9px;
  --radius-lg: 12px;
  --radius-pill: 999px;

  --font: 'Space Grotesk', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
}

input, select, button, textarea {
  font-family: var(--font);
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  color: var(--accent-hover);
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-thumb {
  background: #d9dce1;
  border-radius: 6px;
  border: 2px solid var(--bg);
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font);
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
}

h1 {
  font-size: 1.6rem;
  margin-bottom: 1rem;
}

h2 {
  font-size: 1.15rem;
  margin: 1.5rem 0 0.85rem;
}

.text-muted {
  color: var(--ink-3) !important;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.2rem var(--accent-soft);
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
  text-align: start;
}

/* ==========================================================================
   App shell — dark sidebar + header + content
   ========================================================================== */

.app-shell {
  display: flex;
  align-items: stretch;
  min-height: 100vh;
}

.app-sidebar {
  width: 236px;
  flex: none;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  padding: 22px 16px;
  position: sticky;
  top: 0;
  align-self: flex-start;
  height: 100vh;
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 2px 8px 18px;
  color: inherit;
}
.brand:hover {
  color: inherit;
}
.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex: none;
}
.brand-text {
  display: flex;
  flex-direction: column;
}
.brand-name {
  font-weight: 700;
  font-size: 15px;
  line-height: 1;
  color: #fff;
}
.brand-sub {
  font-weight: 400;
  font-size: 11px;
  color: var(--sidebar-muted);
  margin-top: 3px;
}

.team-switcher {
  padding: 12px 14px;
  margin-bottom: 4px;
  background: var(--sidebar-panel);
  border-radius: 12px;
}
.team-switcher-select {
  display: block;
  width: 100%;
  margin-top: 7px;
  padding: 7px 9px;
  font: 600 13px var(--font);
  color: #fff;
  background: var(--sidebar-input);
  border: 1px solid var(--sidebar-border);
  border-radius: var(--radius);
  cursor: pointer;
}
.team-switcher-select:focus {
  outline: 2px solid var(--sidebar-muted);
  outline-offset: 1px;
}
.team-switcher-submit {
  margin-top: 8px;
  font: 500 12px var(--font);
  color: var(--sidebar-text);
  background: var(--sidebar-input);
  border: 1px solid var(--sidebar-border);
  border-radius: var(--radius);
  padding: 4px 10px;
}

.app-nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 6px;
}

.app-nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 500;
  font-size: 13.5px;
  color: var(--sidebar-text);
  padding: 10px 12px;
  border-radius: var(--radius);
  cursor: pointer;
}
.app-nav-link:hover {
  background: var(--sidebar-panel);
  color: #fff;
}
.app-nav-link.active {
  background: var(--sidebar-panel);
  color: #fff;
}
.app-nav-bar {
  width: 3px;
  height: 14px;
  border-radius: 2px;
  background: transparent;
  flex: none;
}
.app-nav-link.active .app-nav-bar {
  background: #fff;
}

.sidebar-bottom {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sidebar-health {
  padding: 14px;
  background: var(--sidebar-panel);
  border-radius: 12px;
}
.sidebar-health-empty {
  font-size: 12px;
  color: var(--sidebar-muted-2);
  margin-top: 9px;
}
.sidebar-health-status {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 9px;
  font-weight: 600;
  font-size: 13.5px;
}
.sidebar-health-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
}
.sidebar-health-bar {
  display: flex;
  gap: 5px;
  margin-top: 12px;
  height: 6px;
  border-radius: 4px;
  overflow: hidden;
}
.sidebar-health-bar > div {
  height: 100%;
}
.sidebar-health-counts {
  display: flex;
  justify-content: space-between;
  font-weight: 500;
  font-size: 10.5px;
  color: var(--sidebar-muted);
  margin-top: 8px;
}

.sidebar-foot {
  padding: 14px;
  background: var(--sidebar-panel);
  border-radius: 12px;
}
.sidebar-foot-label {
  font-weight: 500;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--sidebar-muted);
}
.sidebar-foot-user {
  display: block;
  font-weight: 600;
  font-size: 13.5px;
  color: #fff;
  margin-top: 8px;
  overflow-wrap: anywhere;
}
.sidebar-foot-user:hover {
  color: #fff;
  text-decoration: underline;
}
.sidebar-foot-logout {
  margin-top: 10px;
  font: 500 12px var(--font);
  color: var(--sidebar-muted);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}
.sidebar-foot-logout:hover {
  color: #fff;
}

.app-main-wrap {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--bg);
  border-bottom: 1px solid var(--border-strong);
  padding: 20px 34px;
}
/* The header's content row — separate from the bar so a page can cap its
   width (ViewData["HeaderMaxWidth"], see _Layout) without shrinking the bar. */
.app-header-inner {
  display: flex;
  align-items: center;
  gap: 18px;
}
.app-header-title {
  flex: 1;
  font-weight: 700;
  font-size: 22px;
  letter-spacing: -0.01em;
}

/* Brand variant of the page header (_Layout's optional HeaderTitle section):
   the Ardent logo and a form name on one row, the group-company names on a
   second. Not sticky — it is tall, and a form page scrolls under it fine. */
.app-header-brand-bar {
  position: static;
}
.app-header-brand {
  flex: 1;
  min-width: 0;
}
.app-header-brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.app-header-brand-logo {
  height: 34px;
  width: auto;
  display: block;
}
.app-header-brand-title {
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.01em;
}
.app-header-family {
  list-style: none;
  margin: 12px 0 0;
  padding: 10px 0 0;
  border-top: 1px solid var(--border-strong);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 28px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .02em;
  color: var(--ink-3);
}

/* A toolbar row above a filtered list — a [data-search-input] box on the
   left, page actions (e.g. "+ New project") pushed to the right. */
.list-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.search-input {
  width: 280px;
  max-width: 60vw;
  font-family: var(--font);
  font-size: 13px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 10px 13px;
}
.search-input:focus {
  border-color: var(--ink);
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.app-content {
  padding: 26px 34px 40px;
  flex: 1;
}

.app-footer {
  padding: 14px 34px;
  color: var(--ink-4);
  font-size: 12px;
  border-top: 1px solid var(--border-soft);
}
.app-footer a {
  color: var(--ink-3);
}

@media (max-width: 900px) {
  .app-shell {
    flex-direction: column;
  }
  .app-sidebar {
    width: 100%;
    height: auto;
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
  }
  .app-nav {
    flex-direction: row;
    flex-wrap: wrap;
    margin-top: 0;
  }
  .sidebar-foot {
    margin-top: 12px;
  }
  .app-header, .app-content, .app-footer {
    padding-left: 18px;
    padding-right: 18px;
  }
  .overview-grid {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   Cards
   ========================================================================== */

.card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: none;
}
.card-title {
  font-weight: 600;
  font-size: 15px;
}
.card-text {
  font-size: 12.5px;
}

/* ==========================================================================
   Tables
   ========================================================================== */

.table {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  border-collapse: collapse;
  overflow: hidden;
  font-size: 0.86rem;
}
.table > thead {
  background: var(--surface-alt);
}
.table > thead th {
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-3);
  border-bottom: 1px solid var(--border);
  padding: 12px 16px;
  white-space: nowrap;
}
.table > tbody td {
  padding: 13px 16px;
  border-top: 1px solid var(--border-soft);
  vertical-align: middle;
  color: var(--ink);
}
.table > tbody tr:hover {
  background: var(--surface-hover);
}
.table > tbody tr[data-href] {
  cursor: pointer;
}

/* Rows flagging an at-risk condition (e.g. projects with no mitigation
   logged yet) — a soft red wash, distinct enough at rest and on hover. */
.table > tbody tr.row-alert {
  background: var(--red-soft);
}
.table > tbody tr.row-alert:hover {
  background: #f6dcda;
}

/* Small inline progress meter — a project's % complete, or anything else
   on a 0-100 scale shown inline in a table cell. */
.meter-track {
  height: 6px;
  min-width: 72px;
  background: var(--surface-sunken);
  border-radius: 4px;
  overflow: hidden;
}
.meter-fill {
  height: 100%;
  background: var(--ink);
  border-radius: 4px;
}
.meter-label {
  font-size: 10.5px;
  font-weight: 500;
  color: var(--ink-4);
  margin-top: 4px;
}

/* ==========================================================================
   Filter chips
   ========================================================================== */

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin-bottom: 18px;
}
.filter-label {
  font-weight: 500;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 7px;
}
.chip-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.chip {
  font-family: var(--font);
  font-weight: 500;
  font-size: 12.5px;
  color: var(--ink-2);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  padding: 6px 13px;
  cursor: pointer;
}
.chip:hover {
  background: var(--surface-hover);
}
.chip.active {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}
/* A chip can be a link when choosing it loads a different view (e.g. the
   Overview's "Needs attention" views) — keep the global a:hover blue off it. */
a.chip:hover {
  color: var(--ink-2);
}
a.chip.active:hover {
  color: #fff;
}

/* Small colored dot next to a free-text status name (e.g. Project
   Status, which is admin-editable, not a fixed enum — so this is a
   best-effort visual cue by common status name, not a guaranteed mapping;
   an unrecognized name just gets the neutral fallback dot). */
.status-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 7px;
  flex: none;
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
  font-family: var(--font);
  font-weight: 600;
  font-size: 13px;
  border-radius: var(--radius);
  padding: 0.55rem 1.1rem;
}
.btn-sm {
  padding: 0.4rem 0.8rem;
  font-size: 12.5px;
  border-radius: var(--radius-sm);
}

.btn-primary {
  --bs-btn-color: #fff;
  --bs-btn-bg: var(--ink);
  --bs-btn-border-color: var(--ink);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: #000;
  --bs-btn-hover-border-color: #000;
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: #000;
  --bs-btn-active-border-color: #000;
  --bs-btn-disabled-bg: var(--ink);
  --bs-btn-disabled-border-color: var(--ink);
}

.btn-secondary {
  --bs-btn-color: var(--ink);
  --bs-btn-bg: var(--surface);
  --bs-btn-border-color: var(--border-strong);
  --bs-btn-hover-color: var(--ink);
  --bs-btn-hover-bg: var(--surface-hover);
  --bs-btn-hover-border-color: var(--border-strong);
  --bs-btn-active-color: var(--ink);
  --bs-btn-active-bg: var(--surface-hover);
  --bs-btn-active-border-color: var(--border-strong);
  --bs-btn-disabled-color: var(--ink-4);
  --bs-btn-disabled-bg: var(--surface);
  --bs-btn-disabled-border-color: var(--border-strong);
}

.btn-outline-secondary {
  --bs-btn-color: var(--ink-2);
  --bs-btn-border-color: var(--border-strong);
  --bs-btn-hover-color: var(--ink);
  --bs-btn-hover-bg: var(--surface-hover);
  --bs-btn-hover-border-color: var(--border-strong);
}

.btn-danger {
  --bs-btn-bg: var(--red);
  --bs-btn-border-color: var(--red);
  --bs-btn-hover-bg: #b8362b;
  --bs-btn-hover-border-color: #b8362b;
  --bs-btn-active-bg: #b8362b;
  --bs-btn-active-border-color: #b8362b;
}

.btn-link {
  --bs-btn-color: var(--accent);
  --bs-btn-hover-color: var(--accent-hover);
  font-weight: 500;
  text-decoration: none;
}

/* ==========================================================================
   Badges (status / RAG / active)
   ========================================================================== */

.badge {
  font-family: var(--font);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.01em;
  padding: 0.42em 0.75em;
  border-radius: var(--radius-pill);
}

.badge.bg-success {
  background-color: var(--green-soft) !important;
  color: var(--green) !important;
}
.badge.bg-danger {
  background-color: var(--red-soft) !important;
  color: var(--red) !important;
}
.badge.bg-warning {
  background-color: var(--amber-soft) !important;
  color: var(--amber) !important;
}
.badge.bg-secondary {
  background-color: var(--surface-sunken) !important;
  color: var(--ink-3) !important;
}
.badge.bg-info {
  background-color: var(--accent-soft) !important;
  color: var(--accent) !important;
}

/* ==========================================================================
   Forms
   ========================================================================== */

.control-label, .form-label, label {
  font-weight: 600;
  font-size: 13px;
  color: var(--ink);
  margin-bottom: 6px;
}

.form-control, .form-select {
  font-family: var(--font);
  font-size: 13.5px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 10px 13px;
  color: var(--ink);
}
.form-control:focus, .form-select:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.form-control::placeholder {
  color: var(--ink-4);
}

.form-text {
  font-size: 12px;
  color: var(--ink-4);
}

.form-check-input:checked {
  background-color: var(--ink);
  border-color: var(--ink);
}

.text-danger {
  color: var(--red) !important;
  font-size: 12.5px;
}

/* ==========================================================================
   Alerts
   ========================================================================== */

.alert {
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-size: 13.5px;
}
.alert-info {
  background: var(--accent-soft);
  border-color: #d3e4fa;
  color: var(--accent-hover);
}
.alert-success {
  background: var(--green-soft);
  border-color: #cdeedd;
  color: var(--green);
}
.alert-danger {
  background: var(--red-soft);
  border-color: var(--red-border);
  color: var(--red);
}
.alert-warning {
  background: var(--amber-soft);
  border-color: #fbe3b8;
  color: var(--amber);
}

/* ==========================================================================
   Definition lists (Profile, etc.)
   ========================================================================== */

dl.row dt {
  font-weight: 600;
  font-size: 12.5px;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding-top: 6px;
}
dl.row dd {
  font-size: 13.5px;
  padding-top: 6px;
}

/* ==========================================================================
   Overview (Home/Index dashboard)
   ========================================================================== */

.section-heading {
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 13px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
  margin-bottom: 22px;
}
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
}
.kpi-card .kpi-value {
  font-weight: 700;
  font-size: 26px;
  letter-spacing: -0.01em;
}
.kpi-card .kpi-label {
  font-size: 12px;
  color: var(--ink-3);
  margin-top: 4px;
}

/* Colored KPI card variants — a soft tinted background + a matching
   border and value color, same "soft pill" language as badges elsewhere,
   just applied to a whole card. .kpi-red is the one deliberately
   different color meant to draw the eye (High priority). */
.kpi-card.kpi-green {
  background: var(--green-soft);
  border-color: #cdeedd;
}
.kpi-card.kpi-green .kpi-value {
  color: var(--green);
}
.kpi-card.kpi-blue {
  background: var(--accent-soft);
  border-color: #d3e4fa;
}
.kpi-card.kpi-blue .kpi-value {
  color: var(--accent);
}
.kpi-card.kpi-red {
  background: var(--red-soft);
  border-color: var(--red-border);
}
.kpi-card.kpi-red .kpi-value {
  color: var(--red);
}
.kpi-card.kpi-gray {
  background: var(--surface-sunken);
  border-color: var(--border-strong);
}
.kpi-card.kpi-gray .kpi-value {
  color: var(--ink-2);
}

.overview-grid {
  display: grid;
  grid-template-columns: 1.7fr 1fr;
  gap: 22px;
  align-items: start;
}

.attention-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  cursor: pointer;
}
.attention-card:hover {
  background: var(--surface-hover);
}
.attention-card .meter-track {
  width: 130px;
}
/* RAG stripe down the left edge — .rag-red / .rag-amber / .rag-green. */
.attention-card.rag-red {
  border-left: 3px solid var(--red);
}
.attention-card.rag-amber {
  border-left: 3px solid var(--amber);
}
.attention-card.rag-green {
  border-left: 3px solid var(--green);
}

.dist-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
}
.dist-row {
  margin-bottom: 14px;
}
.dist-row:last-child {
  margin-bottom: 0;
}
.dist-row-head {
  display: flex;
  justify-content: space-between;
  font-weight: 500;
  font-size: 12.5px;
  margin-bottom: 6px;
}
.dist-track {
  height: 8px;
  background: var(--surface-sunken);
  border-radius: 5px;
  overflow: hidden;
}
.dist-fill {
  height: 100%;
  border-radius: 5px;
}

.capacity-critical {
  background: var(--red-soft);
  border: 1px solid var(--red-border);
  border-radius: var(--radius-lg);
  padding: 16px;
}
.capacity-critical-body {
  font-size: 12.5px;
  line-height: 1.5;
  color: #a35a53;
  margin-top: 7px;
}

/* A solid, high-alarm badge — deliberately not the soft-pill .badge
   treatment used everywhere else (RAG, Priority, Status): this is the one
   "stop and look at this" callout on the page (the capacity risk single
   point of failure), so it gets the design's literal solid red + white
   text instead of the muted pill. */
.badge-solid-danger {
  font-weight: 600;
  font-size: 11px;
  color: #fff;
  background: var(--red);
  padding: 4px 10px;
  border-radius: var(--radius-pill);
}

.resource-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
}
.resource-row {
  margin-bottom: 13px;
}
.resource-row:last-child {
  margin-bottom: 0;
}
.resource-row-head {
  display: flex;
  justify-content: space-between;
  font-weight: 500;
  font-size: 12.5px;
  margin-bottom: 5px;
}
.resource-track {
  height: 5px;
  background: var(--surface-sunken);
  border-radius: 4px;
  overflow: hidden;
}
.resource-fill {
  /* background set inline per row, colored by risk level (see
     Home/Index.cshtml's ResourceLevelColorVar) */
  height: 100%;
  border-radius: 4px;
}

.risk-row {
  display: flex;
  gap: 11px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  cursor: pointer;
}
.risk-row:hover {
  background: var(--surface-hover);
}
.risk-id-badge {
  flex: none;
  height: fit-content;
  font-weight: 600;
  font-size: 11px;
  color: var(--ink-3);
  background: var(--surface-sunken);
  border-radius: var(--radius-sm);
  padding: 3px 7px;
}

/* ==========================================================================
   Project View page
   ========================================================================== */

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px 24px;
}

/* A boxed fact panel — same visual language as .resource-panel/.dist-panel
   on Overview, generalized for reuse (the vitals strip, latest-activity
   preview, and sidebar fact cards on the View page). */
.info-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
}
.info-card + .info-card {
  margin-top: 14px;
}

/* Sidebar fact list inside an .info-card — a stacked label/value pair per
   fact, tighter than .detail-grid since the sidebar column is narrow. */
.fact-row {
  margin-bottom: 14px;
}
.fact-row:last-child {
  margin-bottom: 0;
}

/* ==========================================================================
   Guided tour (wwwroot/js/tour.js)
   Spotlight overlay + a single floating tooltip that repositions itself
   over each step's target. z-index sits above .app-header's 5 and
   Bootstrap's own (dropdowns/modals are z-index 1000+), matching the
   highest layer in the app on purpose — the tour is meant to sit over
   everything, including the sticky header.
   ========================================================================== */

.tour-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  /* Four rectangles around the spotlight hole, sized/positioned by JS via
     custom properties — cheaper to reposition every step than animating a
     box-shadow cutout, and avoids the mask/clip-path Safari quirks. */
  pointer-events: none;
}
.tour-overlay > div {
  position: absolute;
  background: rgba(20, 22, 25, 0.55);
  pointer-events: auto;
}
.tour-target {
  position: fixed;
  z-index: 2001;
  border-radius: var(--radius);
  box-shadow: 0 0 0 3px var(--accent), 0 0 0 6px var(--accent-soft);
  pointer-events: none;
  transition: top 0.18s ease, left 0.18s ease, width 0.18s ease, height 0.18s ease;
}

.tour-card {
  position: fixed;
  z-index: 2002;
  width: 300px;
  max-width: calc(100vw - 32px);
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 32px rgba(20, 22, 25, 0.28);
  padding: 18px 20px;
  transition: top 0.18s ease, left 0.18s ease;
}
.tour-card-eyebrow {
  font-weight: 600;
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}
.tour-card-title {
  font-weight: 600;
  font-size: 15.5px;
  margin-top: 6px;
}
.tour-card-body {
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-2);
  margin-top: 8px;
}
.tour-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 16px;
}
.tour-card-steps {
  font-size: 11.5px;
  color: var(--ink-3);
  font-weight: 500;
}
.tour-card-actions {
  display: flex;
  gap: 8px;
}
.tour-card-skip {
  background: none;
  border: none;
  padding: 0;
  font: 500 12px var(--font);
  color: var(--ink-3);
  cursor: pointer;
}
.tour-card-skip:hover {
  color: var(--ink-2);
}
.tour-card-back,
.tour-card-next {
  border-radius: var(--radius-sm);
  font: 600 12.5px var(--font);
  padding: 7px 14px;
  cursor: pointer;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink);
}
.tour-card-next {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}
.tour-card-next:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}
.tour-card-back:hover {
  background: var(--surface-hover);
}

.sidebar-tour-start {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  font: 500 12px var(--font);
  color: var(--sidebar-muted);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}
.sidebar-tour-start:hover {
  color: #fff;
}

/* ==========================================================================
   Program form (Program Application) — a paper-form look
   Mirrors design/project-intake-form.pdf: a brand header, bordered
   label/value grids, uppercase section headings with an italic prompt
   under each. Used by Views/ProjectRequests/Application.cshtml; reuse it
   for any other form that has to look like the original paper form.
   ========================================================================== */

.pf {
  max-width: 880px;
}

/* Short orientation note under the brand header. */
.pf-intro {
  background: var(--accent-soft);
  border: 1px solid #d3e4fa;
  border-radius: var(--radius);
  padding: 11px 14px;
  font-size: 13px;
  color: var(--ink-2);
  margin-bottom: 22px;
}
.pf-intro b {
  color: var(--ink);
}

/* Bordered label | value grid — the PDF's header tables. */
.pf-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  margin-bottom: 26px;
}
@media (min-width: 768px) {
  .pf-grid {
    grid-template-columns: 1fr 1fr;
  }
}
.pf-table {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--surface);
  overflow: hidden;
  align-self: start;
}
.pf-row {
  display: grid;
  grid-template-columns: 42% 1fr;
}
.pf-row + .pf-row {
  border-top: 1px solid var(--border-strong);
}
.pf-label {
  background: var(--surface-alt);
  border-right: 1px solid var(--border-strong);
  padding: 10px 12px;
  text-align: right;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.35;
  display: flex;
  flex-direction: column;
  justify-content: center;
  margin: 0;
}
.pf-label em {
  font-weight: 400;
  color: var(--ink-3);
}
.pf-value {
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}
.pf-value .form-control,
.pf-value .form-select {
  border-color: transparent;
  background-color: transparent;
}
.pf-value .form-control:hover,
.pf-value .form-select:hover {
  border-color: var(--border-strong);
}
.pf-value .form-control:focus,
.pf-value .form-select:focus {
  border-color: var(--ink);
  background-color: var(--surface);
}
.pf-value .form-control[readonly] {
  color: var(--ink-2);
}

/* YES / NO radios, laid out inline. */
.pf-yesno {
  display: flex;
  gap: 22px;
}
.pf-yesno .form-check {
  margin: 0;
}
.pf-yesno .form-check-label {
  font-size: 13px;
  font-weight: 500;
}

/* One question block: uppercase heading, italic prompt, answer, hints. */
.pf-section {
  margin-bottom: 30px;
}
.pf-heading {
  font-weight: 700;
  font-size: 12.5px;
  letter-spacing: .1em;
  text-transform: uppercase;
  padding-bottom: 7px;
  margin-bottom: 12px;
  border-bottom: 2px solid var(--ink);
}
.pf-prompt {
  display: block;
  font-style: italic;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink);
  margin: 0 0 6px 14px;
}
.pf-prompt + .form-text,
.pf-section .form-text {
  margin-left: 14px;
}
.pf-section .form-control,
.pf-section .form-select {
  margin-left: 0;
}
.pf-question + .pf-question {
  margin-top: 18px;
}

/* Collapsible "see an example" under a question — the answer text itself is
   illustrative only, so it is visibly set apart from the form fields. */
.pf-example {
  margin: 7px 0 0 14px;
  font-size: 12.5px;
  color: var(--ink-2);
}
.pf-example summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 500;
  width: fit-content;
}
.pf-example summary:hover {
  color: var(--accent-hover);
}
.pf-example-body {
  margin-top: 6px;
  padding: 9px 12px;
  background: var(--surface-alt);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  white-space: pre-line;
}

/* Risk table — zebra rows like the PDF's, level and owner narrow. */
.pf-risk {
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  background: var(--surface);
}
.pf-risk th {
  background: var(--surface-alt);
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  text-align: center;
  padding: 9px 10px;
  border-bottom: 1px solid var(--border-strong);
}
.pf-risk td {
  padding: 6px 8px;
  vertical-align: top;
  border-top: 1px solid var(--border-soft);
}
.pf-risk td + td,
.pf-risk th + th {
  border-left: 1px solid var(--border-soft);
}
.pf-risk tbody tr:nth-child(odd) td {
  background: var(--surface-hover);
}
.pf-risk .form-control,
.pf-risk .form-select {
  border-color: transparent;
  background-color: transparent;
}
.pf-risk .form-control:hover,
.pf-risk .form-select:hover {
  border-color: var(--border-strong);
}
.pf-risk .form-control:focus,
.pf-risk .form-select:focus {
  border-color: var(--ink);
  background-color: var(--surface);
}

.pf-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 8px;
}

@media (max-width: 600px) {
  .pf-row {
    grid-template-columns: 1fr;
  }
  .pf-label {
    text-align: left;
    border-right: 0;
    border-bottom: 1px solid var(--border-strong);
  }
}

/* ==========================================================================
   Markdown (free-text answers)
   .md-editor wraps a textarea[data-markdown] (built by js/markdown-editor.js):
   a toolbar + Write/Preview tabs. .md-rendered styles rendered Markdown
   wherever an answer is shown (MarkdownRenderer.Render in a view, or the
   editor's own preview).
   ========================================================================== */

.md-editor {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}
.md-editor:focus-within {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.md-editor .form-control {
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
.md-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  background: var(--surface-alt);
  border-bottom: 1px solid var(--border-strong);
  padding: 4px 6px;
}
.md-tools,
.md-tabs {
  display: flex;
  gap: 2px;
}
.md-tools-off {
  visibility: hidden;
}
.md-btn,
.md-tab {
  font: 500 12px var(--font);
  color: var(--ink-2);
  background: none;
  border: 0;
  border-radius: var(--radius-sm);
  padding: 4px 9px;
  cursor: pointer;
}
.md-btn:hover,
.md-tab:hover {
  background: var(--surface-sunken);
  color: var(--ink);
}
.md-btn-bold {
  font-weight: 700;
}
.md-btn-italic {
  font-style: italic;
}
.md-tab.active {
  background: var(--ink);
  color: #fff;
}
.md-preview {
  padding: 10px 13px;
  min-height: 6em;
}

.md-rendered {
  font-size: 13.5px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.md-rendered > :first-child {
  margin-top: 0;
}
.md-rendered > :last-child {
  margin-bottom: 0;
}
.md-rendered h3,
.md-rendered h4,
.md-rendered h5,
.md-rendered h6 {
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.3;
  margin: .9em 0 .35em;
}
.md-rendered h3 {
  font-size: 15px;
}
.md-rendered h6 {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.md-rendered p,
.md-rendered ul,
.md-rendered ol,
.md-rendered table,
.md-rendered blockquote {
  margin: 0 0 .6em;
}
.md-rendered ul,
.md-rendered ol {
  padding-left: 1.3em;
}
.md-rendered blockquote {
  border-left: 3px solid var(--border-strong);
  padding-left: 12px;
  color: var(--ink-2);
}
.md-rendered code {
  font-size: 12px;
  background: var(--surface-sunken);
  padding: 1px 5px;
  border-radius: 4px;
  color: var(--ink);
}
.md-rendered pre {
  background: var(--surface-sunken);
  border-radius: var(--radius);
  padding: 9px 12px;
  overflow-x: auto;
}
.md-rendered pre code {
  background: none;
  padding: 0;
}
.md-rendered table {
  border-collapse: collapse;
}
.md-rendered th,
.md-rendered td {
  border: 1px solid var(--border-strong);
  padding: 4px 9px;
}
.md-rendered th {
  background: var(--surface-alt);
}
/* Read-only answer on a locked form — framed like the field it replaces. */
.md-readonly {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-alt);
  padding: 9px 13px;
  min-height: 3em;
}
