:root {
  --brand: #123f5a;
  --brand-dark: #0b2d42;
  --accent: #b66a42;
  --gold: #d7b46a;
  --ink: #17242c;
  --muted: #61717b;
  --line: #d8e1e6;
  --page: #f3f7f8;
  --panel: #ffffff;
  --ok: #1f7a4d;
  --warn: #9a6b12;
  --risk: #a43d3d;
  --soft-blue: #e8f0f4;
  --soft-gold: #fbf4e8;
  --shadow: 0 10px 28px rgba(18, 63, 90, 0.12);
  font-family: Arial, Helvetica, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
}

h1,
h2,
h3,
p,
dl,
dd {
  margin: 0;
}

h1 {
  font-size: 24px;
  line-height: 1.15;
}

h2 {
  font-size: 22px;
  line-height: 1.25;
}

h3 {
  font-size: 18px;
  line-height: 1.25;
}

.platform-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  background: var(--brand);
  color: #fff;
  box-shadow: var(--shadow);
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 2px solid var(--gold);
  border-radius: 50%;
  color: var(--brand);
  background: #fff;
  font-weight: 800;
}

.eyebrow {
  margin-bottom: 4px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
  opacity: 0.78;
}

.header-summary {
  display: grid;
  gap: 2px;
  min-width: 156px;
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  background: var(--brand-dark);
}

.header-summary span {
  color: #dbe8ee;
  font-size: 12px;
  font-weight: 700;
}

.header-summary strong {
  font-size: 14px;
}

main {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 16px;
}

.intro-panel,
.dashboard-panel,
.portfolio-section,
.action-section,
.evidence-section,
.module-section {
  margin-bottom: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 2px 12px rgba(23, 36, 44, 0.05);
}

.intro-panel {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 18px;
  align-items: end;
  border-top: 4px solid var(--gold);
}

.intro-panel p:last-child {
  color: var(--muted);
  line-height: 1.5;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 14px;
}

.data-note {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 10px;
  color: var(--muted);
  background: #fbfcfc;
  font-size: 13px;
  font-weight: 800;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}

.metric-card {
  display: grid;
  gap: 7px;
  min-height: 158px;
  padding: 14px;
  border-radius: 8px;
  background: var(--brand-dark);
  color: #fff;
}

.metric-card span {
  color: #dbe8ee;
  font-size: 13px;
  font-weight: 800;
}

.metric-card strong {
  font-size: 25px;
  line-height: 1.1;
}

.metric-card p {
  align-self: end;
  color: #dbe8ee;
  font-size: 13px;
  line-height: 1.35;
}

.primary-metric {
  grid-column: span 2;
  background: var(--brand);
  border-bottom: 4px solid var(--gold);
}

.risk-metric {
  background: #7f3434;
}

.due-metric {
  color: var(--ink);
  background: var(--soft-gold);
  border: 1px solid #efd8a0;
}

.due-metric span,
.due-metric p {
  color: #6d5930;
}

.service-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.service-card {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfc;
}

.service-card-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.score-pill {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 7px 10px;
  color: #fff;
  font-size: 13px;
  font-weight: 800;
}

.score-pill.strong {
  background: var(--ok);
}

.score-pill.caution {
  background: var(--warn);
}

.service-data {
  display: grid;
  gap: 8px;
}

.service-data div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.service-data div:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.service-data dt {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.service-data dd {
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  text-align: right;
}

.section-intro {
  max-width: 860px;
  color: var(--muted);
  line-height: 1.5;
}

.action-tracker,
.evidence-library {
  display: grid;
  gap: 14px;
}

.action-summary-grid,
.evidence-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.action-summary-card,
.evidence-summary-card {
  display: grid;
  gap: 6px;
  min-height: 112px;
  padding: 14px;
  border-radius: 8px;
  color: #fff;
  background: var(--brand-dark);
}

.action-summary-card span,
.evidence-summary-card span {
  color: #dbe8ee;
  font-size: 13px;
  font-weight: 800;
}

.action-summary-card strong,
.evidence-summary-card strong {
  font-size: 26px;
  line-height: 1.1;
}

.overdue-card,
.high-card,
.review-card {
  background: #7f3434;
}

.linked-card {
  background: var(--brand);
}

.due-card,
.recent-card {
  color: var(--ink);
  background: var(--soft-gold);
  border: 1px solid #efd8a0;
}

.due-card span,
.recent-card span {
  color: #6d5930;
}

.filter-panel,
.evidence-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfc;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

input,
select {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  color: var(--ink);
  background: #fff;
  font: inherit;
  font-size: 14px;
}

.evidence-controls {
  grid-template-columns: 1.4fr 0.8fr;
}

.evidence-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.evidence-table {
  width: 100%;
  min-width: 1180px;
  border-collapse: collapse;
}

.evidence-table caption {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.evidence-table th,
.evidence-table td {
  padding: 10px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  font-size: 13px;
  text-align: left;
  vertical-align: top;
}

.evidence-table th {
  color: var(--brand);
  background: var(--soft-blue);
  font-weight: 800;
}

.evidence-table tr:last-child td {
  border-bottom: 0;
}

.evidence-open {
  min-height: 34px;
  border: 0;
  border-radius: 6px;
  padding: 8px 10px;
  color: #fff;
  background: var(--brand);
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.evidence-open:focus-visible {
  outline: 3px solid rgba(215, 180, 106, 0.7);
  outline-offset: 2px;
}

.action-list {
  display: grid;
  gap: 12px;
}

.action-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.action-card[hidden] {
  display: none;
}

.action-card-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.source-pill,
.status-pill {
  display: inline-flex;
  width: max-content;
  max-width: 100%;
  border-radius: 999px;
  padding: 6px 9px;
  font-size: 12px;
  font-weight: 800;
}

.source-pill {
  margin-bottom: 8px;
  color: #fff;
  background: var(--brand);
}

.iso-pill {
  background: var(--accent);
}

.mock-pill {
  color: var(--brand);
  background: var(--soft-blue);
}

.status-pill {
  flex: 0 0 auto;
}

.status-overdue {
  color: #fff;
  background: var(--risk);
}

.status-progress {
  color: #fff;
  background: var(--warn);
}

.status-not-started {
  color: var(--brand);
  background: var(--soft-blue);
}

.status-complete {
  color: #fff;
  background: var(--ok);
}

.status-current {
  color: #fff;
  background: var(--ok);
}

.status-draft {
  color: var(--brand);
  background: var(--soft-blue);
}

.status-archived {
  color: #fff;
  background: var(--muted);
}

.status-expired {
  color: #fff;
  background: var(--risk);
}

.status-review {
  color: #fff;
  background: var(--warn);
}

.action-details {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 14px;
}

.action-details div {
  display: grid;
  gap: 3px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.action-details dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.action-details dd {
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
}

.empty-message {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #fbfcfc;
  font-weight: 800;
}

.evidence-detail {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.evidence-detail-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.detail-description {
  color: var(--muted);
  line-height: 1.5;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px 14px;
}

.detail-grid div,
.detail-columns section {
  display: grid;
  gap: 4px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.detail-grid dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.detail-grid dd,
.detail-columns p {
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
}

.detail-columns {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.detail-columns h4 {
  margin: 0;
  color: var(--brand);
  font-size: 14px;
}

.module-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.module-tile {
  display: grid;
  gap: 10px;
  min-height: 182px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: inherit;
  background: #fbfcfc;
  text-decoration: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.module-tile p {
  color: var(--muted);
  line-height: 1.45;
}

.module-tile.active {
  border-top: 4px solid var(--accent);
  background: #fff;
}

.module-tile.active:hover,
.module-tile.active:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 10px 24px rgba(23, 36, 44, 0.1);
  transform: translateY(-2px);
  outline: none;
}

.module-status {
  width: max-content;
  max-width: 100%;
  border-radius: 999px;
  padding: 6px 9px;
  color: var(--brand);
  background: #dfe9ee;
  font-size: 12px;
  font-weight: 800;
}

.open-status {
  color: #fff;
  background: var(--ok);
}

.coming-soon {
  background: #eef3f5;
}

footer {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 0 16px 26px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

@media (max-width: 1060px) {
  .metric-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .action-summary-grid,
  .evidence-summary-grid,
  .module-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .detail-grid,
  .detail-columns {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .intro-panel,
  .service-grid,
  .filter-panel,
  .evidence-controls {
    grid-template-columns: 1fr;
  }

  .metric-grid,
  .action-summary-grid,
  .evidence-summary-grid,
  .module-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .primary-metric {
    grid-column: span 2;
  }
}

@media (max-width: 640px) {
  .platform-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .header-summary {
    width: 100%;
  }

  main {
    padding: 10px;
  }

  h1 {
    font-size: 21px;
  }

  h2 {
    font-size: 20px;
  }

  .intro-panel,
  .dashboard-panel,
  .portfolio-section,
  .action-section,
  .evidence-section,
  .module-section {
    padding: 14px;
  }

  .section-heading {
    flex-direction: column;
  }

  .metric-grid,
  .action-summary-grid,
  .evidence-summary-grid,
  .module-grid {
    grid-template-columns: 1fr;
  }

  .primary-metric {
    grid-column: span 1;
  }

  .metric-card,
  .module-tile {
    min-height: auto;
  }

  .service-card-header {
    align-items: flex-start;
  }

  .action-card-header,
  .evidence-detail-header,
  .service-data div {
    flex-direction: column;
  }

  .action-details,
  .detail-grid,
  .detail-columns {
    grid-template-columns: 1fr;
  }

  .service-data dd {
    text-align: left;
  }
}

.service-organisation {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.rag-pill {
  display: inline-flex;
  align-items: center;
  min-width: 58px;
  justify-content: center;
  border-radius: 999px;
  padding: 4px 8px;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}

.rag-green {
  background: var(--ok);
}

.rag-amber {
  background: var(--warn);
}

.rag-red {
  background: var(--risk);
}

.rag-grey {
  background: var(--muted);
}

.quality-intelligence-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.intelligence-card {
  display: grid;
  gap: 14px;
  min-height: 280px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfc;
}

.intelligence-card.wide-card {
  grid-column: span 2;
}

.intelligence-card-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.intelligence-card-header h3 {
  color: var(--brand);
}

.intelligence-card-header p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.line-chart,
.bar-chart,
.distribution-chart,
.intelligence-list {
  display: grid;
  gap: 10px;
  align-content: start;
}

.line-chart svg {
  width: 100%;
  min-height: 220px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.line-chart line {
  stroke: #cbd8de;
  stroke-width: 1;
}

.line-chart circle {
  fill: var(--brand);
  stroke: #fff;
  stroke-width: 2;
}

.trend-line {
  fill: none;
  stroke: var(--brand);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.trend-area {
  fill: rgba(18, 63, 90, 0.12);
}

.chart-labels {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chart-labels span {
  display: inline-grid;
  gap: 2px;
  min-width: 72px;
  border-radius: 6px;
  padding: 7px 9px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 800;
}

.chart-labels strong {
  color: var(--muted);
  font-size: 11px;
}

.bar-row,
.distribution-row {
  display: grid;
  gap: 6px;
}

.bar-row-label,
.distribution-row > div:first-child {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.bar-row-label strong,
.distribution-row strong {
  color: var(--brand);
  font-size: 14px;
}

.bar-track {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #dfe9ee;
}

.bar-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--brand);
}

.distribution-row {
  grid-template-columns: 1fr auto;
  align-items: center;
}

.distribution-row .bar-track {
  grid-column: 1 / -1;
}

.rating-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 7px;
  border-radius: 50%;
  vertical-align: middle;
}

.rating-assured,
.rating-assured.rating-dot {
  background: var(--ok);
}

.rating-partial,
.rating-partial.rating-dot {
  background: var(--warn);
}

.rating-not,
.rating-not.rating-dot {
  background: var(--risk);
}

.rating-unreviewed,
.rating-unreviewed.rating-dot {
  background: var(--muted);
}

.intelligence-list-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}

.intelligence-list-item:last-child {
  border-bottom: 0;
}

.intelligence-list-item h4 {
  margin: 0;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.3;
}

.intelligence-list-item p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
}

.intelligence-list-item strong {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 5px 8px;
  color: var(--brand);
  background: var(--soft-blue);
  font-size: 12px;
}

/* Executive Quality Intelligence responsive layout */
.quality-intelligence-section {
  margin-bottom: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 2px 12px rgba(23, 36, 44, 0.05);
}

@media (max-width: 1060px) {
  .quality-intelligence-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .quality-intelligence-grid {
    grid-template-columns: 1fr;
  }

  .intelligence-card.wide-card {
    grid-column: span 1;
  }
}

@media (max-width: 640px) {
  .quality-intelligence-section {
    padding: 14px;
  }

  .intelligence-card {
    min-height: auto;
  }

  .intelligence-list-item {
    flex-direction: column;
  }
}

/* Service Profile module */
.header-link {
  color: inherit;
  text-decoration: none;
}

.service-profile-link {
  color: inherit;
  text-decoration: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.service-profile-link:hover,
.service-profile-link:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 10px 24px rgba(23, 36, 44, 0.1);
  transform: translateY(-2px);
  outline: none;
}

.service-profile-hero,
.profile-section {
  margin-bottom: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 2px 12px rgba(23, 36, 44, 0.05);
}

.service-profile-hero {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  border-top: 4px solid var(--gold);
}

.profile-subtitle {
  margin-top: 6px;
  color: var(--muted);
  font-weight: 800;
}

.back-link {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 8px 11px;
  color: #fff;
  background: var(--brand);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.profile-metric-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.profile-metric {
  display: grid;
  gap: 8px;
  min-height: 118px;
  padding: 14px;
  border-radius: 8px;
  color: #fff;
  background: var(--brand-dark);
}

.profile-metric span {
  color: #dbe8ee;
  font-size: 13px;
  font-weight: 800;
}

.profile-metric strong {
  font-size: 24px;
  line-height: 1.1;
}

.primary-profile-metric {
  background: var(--brand);
  border-bottom: 4px solid var(--gold);
}

.due-profile-metric {
  color: var(--ink);
  background: var(--soft-gold);
  border: 1px solid #efd8a0;
}

.due-profile-metric span {
  color: #6d5930;
}

.profile-chart-grid,
.profile-list-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.profile-domain-card,
.profile-record-card,
.latest-audit-panel,
.profile-detail-panel,
.ai-profile-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fbfcfc;
}

.profile-domain-card {
  display: grid;
  gap: 10px;
}

.profile-domain-score {
  width: max-content;
  border-radius: 999px;
  padding: 7px 10px;
  color: #fff;
  background: var(--brand);
  font-weight: 800;
}

.profile-record-card {
  display: grid;
  gap: 10px;
  width: 100%;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.profile-record-card:not(.static-card):hover,
.profile-record-card:not(.static-card):focus-visible {
  border-color: var(--accent);
  box-shadow: 0 10px 24px rgba(23, 36, 44, 0.1);
  outline: none;
}

.profile-record-card dl,
.latest-audit-summary,
.profile-record-card dl div {
  display: grid;
  gap: 6px;
}

.profile-record-card dl {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.profile-record-card dt,
.latest-audit-summary span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.profile-record-card dd,
.latest-audit-summary strong {
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
}

.latest-audit-panel {
  display: grid;
  gap: 16px;
}

.latest-audit-summary {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.findings-panel {
  display: grid;
  gap: 10px;
}

.findings-panel h3 {
  color: var(--brand);
}

.findings-panel ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 18px;
}

.findings-panel li span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  line-height: 1.4;
}

.profile-detail-panel {
  margin-top: 12px;
  display: grid;
  gap: 14px;
  background: #fff;
}

.timeline-list {
  display: grid;
  gap: 10px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 138px 1fr;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.timeline-item:last-child {
  border-bottom: 0;
}

.timeline-item span {
  color: var(--brand);
  font-size: 13px;
  font-weight: 800;
}

.timeline-item p {
  margin-top: 3px;
  color: var(--muted);
  line-height: 1.4;
}

.ai-profile-panel {
  display: grid;
  gap: 10px;
  border-top: 4px solid var(--gold);
}

.ai-profile-panel p:last-child {
  color: var(--muted);
  font-weight: 800;
}

@media (max-width: 1060px) {
  .profile-metric-grid,
  .profile-chart-grid,
  .profile-list-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .latest-audit-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .service-profile-hero,
  .timeline-item {
    grid-template-columns: 1fr;
  }

  .service-profile-hero {
    flex-direction: column;
  }

  .profile-metric-grid,
  .profile-chart-grid,
  .profile-list-grid,
  .profile-record-card dl,
  .latest-audit-summary {
    grid-template-columns: 1fr;
  }

  .profile-section,
  .service-profile-hero {
    padding: 14px;
  }
}

/* Platform Auth */
.auth-pending main,
.auth-pending footer {
  visibility: hidden;
}

.header-cluster {
  display: flex;
  gap: 10px;
  align-items: stretch;
}

.auth-controls {
  display: grid;
  gap: 4px;
  min-width: 190px;
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  background: rgba(11, 45, 66, 0.92);
}

.auth-controls span {
  color: #dbe8ee;
  font-size: 12px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.auth-controls button,
.primary-login-button {
  min-height: 34px;
  border: 0;
  border-radius: 6px;
  padding: 8px 10px;
  color: var(--brand);
  background: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.auth-controls button:focus-visible,
.primary-login-button:focus-visible {
  outline: 3px solid rgba(215, 180, 106, 0.8);
  outline-offset: 2px;
}

.app-auth-controls {
  min-width: 210px;
}

.login-page {
  min-height: 100vh;
  background: var(--brand);
}

.login-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 18px;
}

.login-panel {
  width: min(440px, 100%);
  display: grid;
  gap: 22px;
  padding: 24px;
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.login-form {
  display: grid;
  gap: 14px;
}

.primary-login-button {
  color: #fff;
  background: var(--brand);
}

.login-message {
  min-height: 20px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.login-error {
  color: var(--risk);
}

@media (max-width: 720px) {
  .header-cluster,
  .auth-controls {
    width: 100%;
  }

  .header-cluster {
    flex-direction: column;
  }
}

/* AI Assurance Assistant module */
.assistant-hero,
.assistant-warning,
.assistant-layout,
.assistant-result-panel,
.assistant-control-panel {
  margin-bottom: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 6px 18px rgba(18, 63, 90, 0.06);
}

.assistant-hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  border-top: 4px solid var(--gold);
}

.assistant-warning {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  border-color: rgba(154, 107, 18, 0.35);
  background: var(--soft-gold);
  color: #5c4515;
  line-height: 1.5;
}

.assistant-warning strong {
  color: var(--warn);
  white-space: nowrap;
}

.assistant-layout {
  display: grid;
  grid-template-columns: minmax(260px, 360px) minmax(0, 1fr);
  gap: 16px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.assistant-control-panel,
.assistant-result-panel {
  align-self: start;
}

.assistant-control-panel {
  display: grid;
  gap: 14px;
}

.assistant-control-panel label {
  display: grid;
  gap: 7px;
  color: var(--brand);
  font-size: 13px;
  font-weight: 800;
}

.assistant-control-panel select,
.assistant-control-panel button {
  width: 100%;
  border-radius: 6px;
  font: inherit;
}

.assistant-control-panel select {
  min-height: 44px;
  border: 1px solid var(--line);
  padding: 10px 12px;
  color: var(--ink);
  background: #fff;
}

.assistant-control-panel button {
  min-height: 46px;
  border: 0;
  padding: 11px 14px;
  color: #fff;
  background: var(--brand);
  font-weight: 800;
  cursor: pointer;
}

.assistant-control-panel button:hover,
.assistant-control-panel button:focus-visible {
  background: var(--brand-dark);
  outline: 3px solid rgba(215, 180, 106, 0.55);
  outline-offset: 2px;
}

.assistant-control-panel button:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

.assistant-result-panel {
  display: grid;
  gap: 14px;
  min-height: 360px;
}

.assistant-loading {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  color: var(--brand);
  background: var(--soft-blue);
  font-weight: 800;
}

.error-message {
  border-color: rgba(164, 61, 61, 0.35);
  color: var(--risk);
  background: #fff4f4;
}

.assistant-results,
.assistant-output-grid {
  display: grid;
  gap: 12px;
}

.assistant-output-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.assistant-output-card,
.assistant-context-card {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
}

.executive-summary-card {
  border-top: 4px solid var(--gold);
}

.assistant-output-card h3,
.assistant-context-card h3 {
  color: var(--brand);
  font-size: 16px;
}

.assistant-output-card p,
.assistant-output-card li,
.assistant-context-card dd,
.assistant-review-note {
  color: var(--ink);
  line-height: 1.5;
}

.assistant-output-card ul {
  margin: 0;
  padding-left: 18px;
}

.assistant-output-card li + li {
  margin-top: 7px;
}

.assistant-context-card dl {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.assistant-context-card div {
  display: grid;
  gap: 4px;
}

.assistant-context-card dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.assistant-context-card dd {
  font-weight: 800;
}

.assistant-review-note {
  border-left: 4px solid var(--gold);
  padding: 10px 12px;
  background: var(--soft-gold);
  color: #5c4515;
  font-weight: 800;
}

@media (max-width: 960px) {
  .assistant-layout,
  .assistant-output-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .assistant-hero,
  .assistant-warning {
    flex-direction: column;
  }

  .assistant-hero,
  .assistant-warning,
  .assistant-control-panel,
  .assistant-result-panel {
    padding: 14px;
  }

  .assistant-warning strong {
    white-space: normal;
  }

  .assistant-context-card dl {
    grid-template-columns: 1fr;
  }
}

/* Client User Management */
.role-platform-owner-only {
  display: none;
}

body.role-platform_owner .role-platform-owner-only {
  display: grid;
}

.access-denied-panel {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 18px;
  background: var(--page);
}

.access-denied-panel section {
  width: min(560px, 100%);
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-top: 4px solid var(--gold);
  border-radius: 8px;
  padding: 22px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.admin-hero,
.admin-panel {
  margin-bottom: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 6px 18px rgba(18, 63, 90, 0.06);
}

.admin-hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  border-top: 4px solid var(--gold);
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(260px, 350px) minmax(0, 1fr);
  gap: 16px;
}

.admin-form-panel {
  display: grid;
  gap: 14px;
  align-self: start;
}

.admin-form-panel label,
.admin-users-table label {
  display: grid;
  gap: 7px;
  color: var(--brand);
  font-size: 13px;
  font-weight: 800;
}

.admin-form-panel input,
.admin-form-panel select,
.admin-form-panel button,
.admin-users-table select,
.admin-users-table button {
  border-radius: 6px;
  font: inherit;
}

.admin-form-panel input,
.admin-form-panel select,
.admin-users-table select {
  min-height: 42px;
  border: 1px solid var(--line);
  padding: 9px 10px;
  color: var(--ink);
  background: #fff;
}

.admin-form-panel button,
.admin-users-table button {
  min-height: 40px;
  border: 0;
  padding: 9px 12px;
  color: #fff;
  background: var(--brand);
  font-weight: 800;
  cursor: pointer;
}

.admin-form-panel button:hover,
.admin-form-panel button:focus-visible,
.admin-users-table button:hover,
.admin-users-table button:focus-visible {
  background: var(--brand-dark);
  outline: 3px solid rgba(215, 180, 106, 0.55);
  outline-offset: 2px;
}

.admin-table-wrap {
  overflow-x: auto;
}

.admin-users-table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
}

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

.admin-users-table th {
  color: var(--brand);
  font-size: 12px;
  text-transform: uppercase;
}

.admin-users-table td:first-child {
  display: grid;
  gap: 4px;
}

.admin-users-table td:first-child strong {
  color: var(--ink);
}

.admin-users-table td:first-child span {
  color: var(--muted);
  font-size: 13px;
}

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

.admin-row-actions button:last-child {
  color: var(--risk);
  background: #fff4f4;
  border: 1px solid rgba(164, 61, 61, 0.35);
}

@media (max-width: 960px) {
  .admin-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .admin-hero {
    flex-direction: column;
  }

  .admin-hero,
  .admin-panel {
    padding: 14px;
  }
}


.action-card {
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.action-card:hover,
.action-card:focus-visible {
  border-color: rgba(21, 64, 84, 0.42);
  box-shadow: 0 14px 30px rgba(21, 64, 84, 0.14);
  cursor: pointer;
  transform: translateY(-1px);
}

.action-card:focus-visible {
  outline: 3px solid rgba(215, 180, 106, 0.72);
  outline-offset: 3px;
}

.action-card-cue {
  margin: 0;
  color: var(--brand);
  font-size: 13px;
  font-weight: 900;
}

.modal-shell[hidden] {
  display: none;
}

.modal-shell {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 18px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 30, 42, 0.54);
}

.action-detail-modal {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 16px;
  width: min(860px, 100%);
  max-height: min(86vh, 920px);
  overflow: auto;
  padding: 22px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: 0 24px 70px rgba(8, 30, 42, 0.28);
}

.action-detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.icon-button {
  display: inline-grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--brand);
  background: #fff;
  font: inherit;
  font-size: 24px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
}

.icon-button:hover,
.icon-button:focus-visible {
  background: var(--soft-blue);
  outline: 3px solid rgba(215, 180, 106, 0.5);
  outline-offset: 2px;
}

.modal-status {
  min-height: 20px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.modal-status.is-error {
  color: var(--risk);
}

.action-edit-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.action-edit-form[hidden] {
  display: none;
}

.action-edit-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.action-edit-form input,
.action-edit-form select,
.action-edit-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 11px;
  color: var(--ink);
  background: #fff;
  font: inherit;
  font-size: 14px;
}

.action-edit-form label:last-of-type {
  grid-column: 1 / -1;
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.modal-actions[hidden] {
  display: none;
}

.primary-button,
.secondary-button,
.danger-button {
  min-height: 40px;
  border-radius: 8px;
  padding: 9px 14px;
  font: inherit;
  font-size: 14px;
  font-weight: 900;
  cursor: pointer;
}

.primary-button {
  border: 1px solid var(--brand);
  color: #fff;
  background: var(--brand);
}

.secondary-button {
  border: 1px solid var(--line);
  color: var(--brand);
  background: #fff;
}

.danger-button {
  border: 1px solid var(--risk);
  color: #fff;
  background: var(--risk);
}

.primary-button:hover,
.secondary-button:hover,
.danger-button:hover,
.primary-button:focus-visible,
.secondary-button:focus-visible,
.danger-button:focus-visible {
  box-shadow: 0 8px 18px rgba(21, 64, 84, 0.16);
  outline: 3px solid rgba(215, 180, 106, 0.5);
  outline-offset: 2px;
}

@media (max-width: 720px) {
  .action-detail-modal {
    max-height: 90vh;
    padding: 18px;
  }

  .action-edit-form {
    grid-template-columns: 1fr;
  }

  .modal-actions {
    justify-content: stretch;
  }

  .modal-actions button {
    flex: 1 1 140px;
  }
}
