/* ================================================
   Synthesis Software Technologies
   AI Adoption Dashboard — Theme
   ================================================ */

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

#quarto-content {
  padding: 2rem 0 3rem;
}

main.content {
  background: white;
  padding: 3rem 3.5rem;
  border-radius: 6px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.09);
  max-width: 1200px;
}

/* --- Quick section navigation --- */

.section-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  margin: 0.4rem 0 1.35rem;
  padding: 0.7rem 0.8rem;
  background: linear-gradient(90deg, #f8fafc, #eef2ff);
  border: 1px solid #e2e8f0;
  border-radius: 6px;
}

.section-nav-label {
  font-size: 0.63rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 700;
  color: #64748b;
}

.section-nav-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.section-chip {
  display: inline-block;
  padding: 0.28rem 0.58rem;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #0f3460;
  font-size: 0.73rem;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  transition: all 0.18s ease;
}

.section-chip:hover {
  border-color: #0f3460;
  background: #e0e7ff;
  color: #0b2547;
}

/* --- Global dashboard filters --- */

.dashboard-filters {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.7rem;
  flex-wrap: wrap;
  width: 100%;
  box-sizing: border-box;
  margin: 0.55rem 0 1.2rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #f8fafc;
}

.dashboard-filters > * {
  align-self: center;
}

.dashboard-filter-label {
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 700;
  color: #64748b;
}

.dept-filter-mode {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.dept-mode-option {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  height: 32px;
  padding: 0.22rem 0.55rem;
  margin: 0;
  background: #ffffff;
  color: #334155;
  font-size: 0.73rem;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
}

.dept-mode-option:has(input:checked) {
  border-color: #0f3460;
  background: #e0e7ff;
  color: #0b2547;
}

.dept-mode-option input {
  margin: 0;
}

.dept-filter {
  position: relative;
  display: inline-flex;
  align-items: center;
  margin: 0;
}

.dimension-filter {
  position: relative;
  display: inline-flex;
  align-items: center;
  margin: 0;
}

.dept-filter > summary,
.dimension-filter > summary {
  list-style: none;
  margin: 0;
  cursor: pointer;
  user-select: none;
}

.dept-filter-summary {
  gap: 0.45rem;
  height: 32px;
  padding: 0.22rem 0.62rem;
}

.dept-filter > summary::-webkit-details-marker,
.dimension-filter > summary::-webkit-details-marker {
  display: none;
}

.dept-filter > summary::marker,
.dimension-filter > summary::marker {
  content: "";
}

.dept-filter-title {
  font-size: 0.73rem;
  font-weight: 600;
  line-height: 1;
}

.dept-filter-count {
  font-size: 0.73rem;
  color: #64748b;
  line-height: 1;
}

.dept-filter-menu {
  position: absolute;
  top: calc(100% + 0.35rem);
  left: 0;
  min-width: 290px;
  max-width: min(92vw, 460px);
  max-height: 260px;
  overflow: auto;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #ffffff;
  box-shadow: 0 8px 20px rgba(15, 52, 96, 0.12);
  padding: 0.45rem;
  z-index: 8;
}

.dimension-filter .dept-filter-menu {
  min-width: 230px;
}

.dept-filter-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.3rem 0.35rem;
  border-radius: 4px;
  font-size: 0.8rem;
  color: #374151;
  cursor: pointer;
}

.dept-filter-row:hover {
  background: #f1f5f9;
}

.dept-filter-row input {
  margin: 0;
}

.dept-filter-clear {
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  height: 32px;
  background: #ffffff;
  color: #334155;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.34rem 0.58rem;
  cursor: pointer;
}

.dept-filter-clear:hover {
  border-color: #94a3b8;
}

/* --- Title block --- */

#title-block-header {
  border-bottom: 2px solid #1A1A2E;
  padding-bottom: 1.5rem;
  margin-bottom: 1.5rem;
}

#title-block-header::before {
  content: "SYNTHESIS SOFTWARE TECHNOLOGIES  ·  TECHNOLOGY OFFICE";
  display: block;
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #9ca3af;
  margin-bottom: 0.9rem;
}

h1.title {
  font-size: 2.6rem !important;
  font-weight: 800 !important;
  letter-spacing: -0.025em !important;
  line-height: 1.05 !important;
  color: #1A1A2E !important;
  border-bottom: none !important;
  padding-bottom: 0 !important;
  margin-bottom: 0.15rem !important;
}

p.subtitle {
  font-family: Georgia, 'Times New Roman', serif;
  font-style: italic;
  font-size: 1.4rem !important;
  color: #6b7280 !important;
  font-weight: 400 !important;
  margin-top: 0 !important;
  line-height: 1.2;
}

.doc-meta {
  margin: 0.9rem 0 1.75rem;
  font-size: 0.65rem;
  color: #9ca3af;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.doc-meta strong {
  color: #6b7280;
  font-weight: 700;
}

/* --- Section headings --- */

h2 {
  font-size: 1.05rem !important;
  font-weight: 700 !important;
  color: #16213E !important;
  text-transform: uppercase !important;
  letter-spacing: 0.08em !important;
  border-bottom: 1px solid #ADB5BD !important;
  padding-bottom: 0.4rem !important;
  margin: 2.25rem 0 1rem !important;
  scroll-margin-top: 88px;
}

/* --- Body prose --- */

p {
  font-size: 0.92rem;
  color: #4b5563;
  line-height: 1.7;
}

p code, code {
  background: #f1f5f9;
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  font-size: 0.85em;
  color: #0F3460;
}

/* --- KPI grid --- */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin: 1.5rem 0 2rem;
}

.kpi {
  background: linear-gradient(135deg, #1A1A2E 0%, #0F3460 100%);
  color: white;
  padding: 1.5rem 1.25rem;
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}

.kpi-value {
  font-size: 2.4rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.025em;
  margin-bottom: 0.5rem;
}

.kpi-label {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #cbd5e1;
  margin-bottom: 0.4rem;
}

.kpi-sub {
  font-size: 0.78rem;
  color: #94a3b8;
}

/* Alert KPI — used for activation gaps (e.g. employees with no tools). */
.kpi.kpi-alert {
  background: linear-gradient(135deg, #7f1d1d 0%, #b91c1c 100%);
}

.kpi.kpi-alert .kpi-label {
  color: #fecaca;
}

.kpi.kpi-alert .kpi-sub {
  color: #fee2e2;
}

/* Secondary KPI strip — smaller cards beneath a section header. */
.kpi-grid.kpi-grid-secondary {
  margin: 0.5rem 0 1.25rem;
}

.kpi-grid.kpi-grid-secondary .kpi {
  background: #1A1A2E;
  padding: 1rem 1.1rem;
}

.kpi-grid.kpi-grid-secondary .kpi-value {
  font-size: 1.75rem;
}

/* --- Insight callouts (auto-derived 🟢/🟡/🔴/🤖/📊/🎯) --- */

.insight-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.65rem;
  margin: 0.75rem 0 1.5rem;
}

.insight {
  display: grid;
  grid-template-columns: 32px 1fr;
  align-items: start;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-radius: 5px;
  border-left: 4px solid #cbd5e1;
  background: #f8fafc;
}

.insight-icon {
  font-size: 1.25rem;
  line-height: 1;
  padding-top: 0.1rem;
}

.insight-headline {
  font-weight: 700;
  font-size: 0.92rem;
  color: #1f2937;
  margin-bottom: 0.2rem;
}

.insight-detail {
  font-size: 0.82rem;
  color: #475569;
  line-height: 1.45;
}

.insight-green  { border-left-color: #16a34a; background: #f0fdf4; }
.insight-amber  { border-left-color: #d97706; background: #fffbeb; }
.insight-red    { border-left-color: #dc2626; background: #fef2f2; }
.insight-blue   { border-left-color: #0F3460; background: #f0f4ff; }

/* --- Alignment matrix (Aligned / Add Tools / Gap) --- */

.align-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin: 0.75rem 0 1.5rem;
}

.align-card {
  padding: 1.15rem 1.25rem;
  border-radius: 5px;
  border-top: 4px solid #cbd5e1;
  background: white;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.align-value {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 0.55rem;
  color: #1A1A2E;
  font-variant-numeric: tabular-nums;
}

.align-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #374151;
  margin-bottom: 0.4rem;
}

.align-sub {
  font-size: 0.78rem;
  color: #6b7280;
  line-height: 1.45;
}

.align-good   { border-top-color: #16a34a; }
.align-good   .align-value { color: #166534; }
.align-warn   { border-top-color: #d97706; }
.align-warn   .align-value { color: #92400e; }
.align-danger { border-top-color: #dc2626; }
.align-danger .align-value { color: #991b1b; }

/* --- Strategic theme cards (Priority / Scale / Amplify) --- */

.theme-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin: 0.75rem 0 1.5rem;
}

.theme-card {
  padding: 1.1rem 1.25rem 1.25rem;
  border-radius: 5px;
  background: white;
  border-top: 5px solid #cbd5e1;
  box-shadow: 0 1px 3px rgba(0,0,0,0.07);
  display: flex;
  flex-direction: column;
}

.theme-header {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 0.7rem;
}

.theme-icon {
  font-size: 1.05rem;
  line-height: 1;
}

.theme-badge {
  font-size: 0.62rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  padding: 0.18rem 0.55rem;
  border-radius: 3px;
  background: #f1f5f9;
  color: #475569;
}

.theme-title {
  font-size: 1.02rem;
  font-weight: 700;
  color: #1A1A2E;
  margin-bottom: 0.8rem;
}

.theme-body, .theme-actions {
  list-style: none;
  padding: 0;
  margin: 0 0 0.85rem;
  font-size: 0.84rem;
  color: #374151;
  line-height: 1.55;
}

.theme-body li {
  padding: 0.1rem 0;
}

.theme-actions li {
  position: relative;
  padding: 0.15rem 0 0.15rem 1rem;
}

.theme-actions li::before {
  content: "→";
  position: absolute;
  left: 0;
  color: #94a3b8;
  font-weight: 700;
}

.theme-actions li code {
  font-size: 0.78rem;
}

.theme-divider {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #94a3b8;
  border-top: 1px solid #e5e7eb;
  padding-top: 0.6rem;
  margin-bottom: 0.4rem;
}

.theme-red    { border-top-color: #dc2626; }
.theme-red    .theme-badge { background: #fee2e2; color: #991b1b; }
.theme-amber  { border-top-color: #d97706; }
.theme-amber  .theme-badge { background: #fef3c7; color: #92400e; }
.theme-green  { border-top-color: #16a34a; }
.theme-green  .theme-badge { background: #dcfce7; color: #166534; }

/* --- Bar block (horizontal bars) --- */

.bar-block {
  margin: 1rem 0 1.25rem;
}

.bar-row {
  display: grid;
  grid-template-columns: 180px 1fr 130px;
  align-items: center;
  gap: 1rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid #f1f5f9;
}

.bar-row:last-child {
  border-bottom: none;
}

.bar-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: #374151;
}

.bar-track {
  background: #f1f5f9;
  height: 14px;
  border-radius: 7px;
  overflow: hidden;
  position: relative;
}

.bar-fill {
  height: 100%;
  background: #0F3460;
  border-radius: 7px;
  transition: width 0.25s ease;
}

.bar-value {
  font-size: 0.85rem;
  color: #1f2937;
  font-variant-numeric: tabular-nums;
  text-align: right;
  font-weight: 600;
}

.bar-pct {
  color: #9ca3af;
  font-weight: 400;
  font-size: 0.78rem;
}

/* Tool-specific bar colors */
.bar-row.tool-claude   .bar-fill { background: #D97706; }
.bar-row.tool-cursor   .bar-fill { background: #0D6EFD; }
.bar-row.tool-chatgpt  .bar-fill { background: #198754; }
.bar-row.tool-copilot  .bar-fill { background: #495057; }
.bar-row.tool-gemini   .bar-fill { background: #8B44AC; }

/* Tag colors */
.bar-row.tag-productive .bar-fill { background: #16a34a; }
.bar-row.tag-other      .bar-fill { background: #94a3b8; }

/* AI tier bar colors (L3 = best, L0 = none, TBD = unknown) */
.bar-row.tier-l3  .bar-fill { background: #16a34a; }
.bar-row.tier-l2  .bar-fill { background: #65a30d; }
.bar-row.tier-l1  .bar-fill { background: #eab308; }
.bar-row.tier-l0  .bar-fill { background: #94a3b8; }
.bar-row.tier-tbd .bar-fill { background: #cbd5e1; }

/* Tool delta indicators (▲ / ▼ vs prior month) */
.delta-up   { color: #16a34a; font-weight: 700; }
.delta-down { color: #dc2626; font-weight: 700; }
.delta-flat { color: #6b7280; font-weight: 600; }
.delta-none { color: #cbd5e1; }

/* --- Adoption tables --- */

table.adoption-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.75rem 0 1.25rem;
  font-size: 0.88rem;
}

.table-shell {
  margin: 0.45rem 0 1rem;
}

.table-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  flex-wrap: wrap;
  margin: 0 0 0.45rem;
}

.table-search {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #64748b;
  font-weight: 700;
}

.table-search input {
  width: 250px;
  max-width: 72vw;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  padding: 0.36rem 0.5rem;
  font-size: 0.82rem;
  color: #1f2937;
  background: #ffffff;
}

.table-search input:focus {
  outline: none;
  border-color: #0f3460;
  box-shadow: 0 0 0 3px rgba(15, 52, 96, 0.12);
}

.table-meta {
  font-size: 0.75rem;
  color: #6b7280;
}

.adoption-table th {
  background: #1A1A2E;
  color: white;
  text-align: left;
  padding: 0.55rem 0.85rem;
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  border: 1px solid #1A1A2E;
}

.adoption-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
}

.adoption-table thead th.sortable {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  position: relative;
  padding-right: 1.2rem;
}

.adoption-table thead th.sortable::after {
  content: "↕";
  position: absolute;
  right: 0.35rem;
  color: #94a3b8;
  font-size: 0.65rem;
}

.adoption-table thead th.sorted-asc::after {
  content: "▲";
  color: #e2e8f0;
}

.adoption-table thead th.sorted-desc::after {
  content: "▼";
  color: #e2e8f0;
}

.adoption-table th:nth-child(n+2) {
  text-align: right;
}

.adoption-table td {
  padding: 0.5rem 0.85rem;
  border: 1px solid #ADB5BD;
  color: #1f2937;
  font-variant-numeric: tabular-nums;
}

.adoption-table td:nth-child(n+2) {
  text-align: right;
}

.adoption-table tbody tr:nth-child(odd) td {
  background: #F0F4FF;
}

/* Percentage pills */
.pct-pill {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  border-radius: 10px;
  font-size: 0.78rem;
  font-weight: 700;
  min-width: 48px;
  text-align: center;
}

.tier-excellent { background: #dcfce7; color: #166534; }
.tier-good      { background: #dbeafe; color: #1e40af; }
.tier-fair      { background: #fef3c7; color: #92400e; }
.tier-poor      { background: #fee2e2; color: #991b1b; }

/* --- Data quality cards --- */

.dq-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin: 1rem 0 1.5rem;
}

.dq-card {
  background: #FFFBEB;
  border-left: 4px solid #D97706;
  padding: 1.1rem 1.25rem;
  border-radius: 4px;
}

.dq-value {
  font-size: 1.9rem;
  font-weight: 800;
  color: #92400e;
  line-height: 1;
  margin-bottom: 0.4rem;
}

.dq-label {
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #374151;
  margin-bottom: 0.35rem;
}

.dq-sub {
  font-size: 0.78rem;
  color: #6b7280;
  line-height: 1.4;
}

/* --- Project commentary drill-through --- */

.project-detail {
  margin: 0.75rem 0 1rem;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #ffffff;
}

.project-detail > summary {
  cursor: pointer;
  padding: 0.7rem 0.9rem;
  font-size: 0.88rem;
  font-weight: 700;
  color: #1A1A2E;
  list-style-position: inside;
}

.project-detail > summary span {
  margin-left: 0.4rem;
  color: #64748b;
  font-weight: 600;
  font-size: 0.76rem;
}

.project-detail[open] > summary {
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
}

.project-detail .table-shell,
.project-detail table.adoption-table {
  margin: 0.75rem;
  width: calc(100% - 1.5rem);
}

/* --- Back to top button --- */

.back-to-top {
  position: fixed;
  right: 1.1rem;
  bottom: 1.1rem;
  border: none;
  border-radius: 999px;
  padding: 0.48rem 0.84rem;
  background: #0f3460;
  color: white;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(15, 52, 96, 0.28);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: all 0.2s ease;
}

.back-to-top.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* --- Notes and footer --- */

p.note {
  font-size: 0.78rem;
  color: #6b7280;
  font-style: italic;
  margin: 0.5rem 0 1.25rem;
}

p.footer {
  margin-top: 2.5rem;
  padding-top: 1rem;
  border-top: 1px solid #ADB5BD;
  font-size: 0.72rem;
  color: #9ca3af;
}

/* --- Responsive --- */

@media (max-width: 900px) {
  .kpi-grid    { grid-template-columns: repeat(2, 1fr); }
  .dq-grid     { grid-template-columns: 1fr; }
  .insight-grid { grid-template-columns: 1fr; }
  .align-grid  { grid-template-columns: 1fr; }
  .theme-grid  { grid-template-columns: 1fr; }
  .bar-row     { grid-template-columns: 130px 1fr 100px; gap: 0.6rem; }
  main.content { padding: 2rem 1.5rem; }
  .table-controls { align-items: stretch; }
  .table-search { width: 100%; justify-content: space-between; }
  .table-search input { width: 65%; }
}

@media (max-width: 640px) {
  .section-nav {
    padding: 0.65rem;
  }

  .dashboard-filters {
    align-items: flex-start;
  }

  .dept-filter,
  .dimension-filter,
  .dept-filter > summary,
  .dimension-filter > summary,
  .dept-filter-clear {
    width: 100%;
  }

  .dept-filter-mode {
    width: 100%;
  }

  .dept-filter-menu {
    min-width: 0;
    width: min(92vw, 460px);
  }

  .table-search {
    flex-direction: column;
    align-items: flex-start;
  }

  .table-search input {
    width: 100%;
  }

  .bar-row {
    grid-template-columns: 1fr;
    gap: 0.35rem;
  }

  .bar-value {
    text-align: left;
  }
}
