/* ============================================================
   DATA CAPTURE SPECIFICATION — Page-specific styles
   Extends wiki.css from Phase 04 for full-width app layout
   ============================================================ */

/* ---- Full-width app layout (no sidebar) ---- */
.app-layout {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 var(--space-2xl) var(--space-3xl);
  min-height: calc(100vh - var(--header-height));
}

/* ---- Source file callout ---- */
.source-callout {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  background: var(--grey-50, #FCFCFB);
  border: 1px solid var(--grey-100);
  border-radius: 4px;
  padding: var(--space-sm) var(--space-md);
  margin-top: var(--space-md);
  font-size: 0.75rem;
  color: var(--grey-400);
}
.source-callout__label {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--charcoal);
  white-space: nowrap;
}

/* ---- Export bar ---- */
.export-bar {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-top: var(--space-md);
}
.export-btn {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border: 1px solid var(--near-black);
  border-radius: 4px;
  background: var(--near-black);
  color: #fff;
  font-family: var(--font-heading);
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.export-btn:hover {
  background: var(--charcoal);
  border-color: var(--charcoal);
}
.export-btn--seed {
  background: #fff;
  color: var(--near-black);
  border-color: var(--grey-200);
}
.export-btn--seed:hover {
  background: var(--grey-50, #FCFCFB);
  border-color: var(--charcoal);
}
.export-bar__note {
  font-size: 0.6875rem;
  color: var(--grey-400);
}

/* ---- Coverage progress section ---- */
.coverage-section {
  margin: var(--space-xl) 0;
}
.coverage-section__title {
  font-family: var(--font-heading);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--charcoal);
  margin-bottom: var(--space-md);
}
.coverage-bars {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: var(--space-sm) var(--space-xl);
}
.coverage-bar {
  display: grid;
  grid-template-columns: 140px 1fr 44px;
  gap: var(--space-sm);
  align-items: center;
}
.coverage-bar__label {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--charcoal);
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.coverage-bar__track {
  height: 18px;
  background: var(--grey-100);
  border-radius: 3px;
  overflow: hidden;
}
.coverage-bar__fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s ease;
  min-width: 0;
}
.coverage-bar__fill--green { background: #009592; }
.coverage-bar__fill--amber { background: #7000FF; }
.coverage-bar__fill--red { background: #BF0092; }
.coverage-bar__fill--empty { background: var(--grey-200); width: 0; }
.coverage-bar__value {
  font-family: var(--font-heading);
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--charcoal);
}

/* ---- Filter enhancements ---- */
.filter-section {
  margin-bottom: var(--space-lg);
}
.filter-row {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: var(--space-sm);
}
.filter-row__label {
  font-family: var(--font-heading);
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--grey-400);
  min-width: 60px;
}
.filter-select {
  padding: 7px 12px;
  border: 1px solid var(--grey-200);
  border-radius: 4px;
  font-family: var(--font-body);
  font-size: 0.8125rem;
  color: var(--charcoal);
  background: #fff;
  outline: none;
  cursor: pointer;
  transition: border-color 0.15s ease;
  min-width: 180px;
}
.filter-select:focus { border-color: var(--near-black); }
.filter-search {
  flex: 1;
  max-width: 320px;
  padding: 7px 12px;
  border: 1px solid var(--grey-200);
  border-radius: 4px;
  font-family: var(--font-body);
  font-size: 0.8125rem;
  color: var(--charcoal);
  outline: none;
  transition: border-color 0.15s ease;
}
.filter-search:focus { border-color: var(--near-black); }
.filter-search::placeholder { color: var(--grey-300); }
.filter-results {
  font-family: var(--font-heading);
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--grey-400);
  margin-left: auto;
}

/* ---- Task table ---- */
.task-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-top: var(--space-md);
}
.task-table {
  width: 100%;
  border-collapse: collapse;
}
.task-table thead th {
  font-family: var(--font-heading);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-align: left;
  padding: var(--space-sm) var(--space-md);
  border-bottom: 2px solid var(--exeter-yellow);
  color: var(--charcoal);
  cursor: pointer;
  user-select: none;
  position: relative;
  padding-right: 20px;
  white-space: nowrap;
}
.task-table thead th::after {
  content: '\2195';
  position: absolute;
  right: 4px;
  font-size: 0.55rem;
  color: var(--grey-300);
}
.task-table thead th.sort-asc::after { content: '\25B2'; color: var(--near-black); }
.task-table thead th.sort-desc::after { content: '\25BC'; color: var(--near-black); }
.task-table thead th.no-sort { cursor: default; padding-right: var(--space-md); }
.task-table thead th.no-sort::after { display: none; }

.task-table tbody tr.task-row {
  cursor: pointer;
  transition: background 0.1s ease;
}
.task-table tbody tr.task-row:hover { background: rgba(255, 237, 0, 0.06); }
.task-table tbody tr.task-row--expanded { background: var(--grey-50, #FCFCFB); }
.task-table tbody td {
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--grey-100);
  font-size: 0.8125rem;
  color: var(--text-secondary);
  vertical-align: middle;
  line-height: 1.4;
}
.task-table tbody td:first-child {
  font-weight: 600;
  color: var(--near-black);
}

/* System badge */
.system-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 3px;
  font-family: var(--font-heading);
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.system-badge--highway { background: #E9D8FF; color: #410095; }
.system-badge--ssg { background: #FFD8F6; color: #950071; }
.system-badge--both { background: #D8FFFE; color: #006A69; }

/* Demand type badge */
.demand-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 3px;
  font-family: var(--font-heading);
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.demand-badge--value { background: #e6f4ea; color: #1e7e34; }
.demand-badge--failure { background: #fce8e6; color: #c5221f; }
.demand-badge--tbc { background: var(--grey-100); color: var(--grey-400); }

/* Coverage cell with mini progress bar */
.coverage-cell {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  min-width: 100px;
}
.coverage-mini {
  flex: 1;
  height: 6px;
  background: var(--grey-100);
  border-radius: 3px;
  overflow: hidden;
  min-width: 40px;
}
.coverage-mini__fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s ease;
}
.coverage-mini__fill--red { background: #BF0092; }
.coverage-mini__fill--amber { background: #7000FF; }
.coverage-mini__fill--green { background: #009592; }
.coverage-text {
  font-family: var(--font-heading);
  font-size: 0.6875rem;
  font-weight: 700;
  white-space: nowrap;
}
.coverage-text--red { color: #950071; }
.coverage-text--amber { color: #410095; }
.coverage-text--green { color: #006A69; }

/* Complaints count */
.complaint-count {
  font-family: var(--font-heading);
  font-size: 0.6875rem;
  font-weight: 700;
}
.complaint-count--zero { color: var(--grey-300); }
.complaint-count--linked { color: var(--near-black); }

/* SLA cell */
.sla-text {
  font-size: 0.75rem;
  white-space: nowrap;
}
.sla-text--none { color: var(--grey-300); }

/* Row expand arrow */
.expand-arrow {
  display: inline-block;
  transition: transform 0.2s ease;
  font-size: 0.55rem;
  color: var(--grey-300);
  margin-right: var(--space-xs);
}
.task-row--expanded .expand-arrow { transform: rotate(90deg); color: var(--near-black); }

/* ---- Expanded panel ---- */
.expanded-panel {
  display: none;
  border-bottom: 2px solid var(--exeter-yellow);
}
.expanded-panel--open { display: table-row; }
.expanded-panel td {
  padding: var(--space-xl) var(--space-md) !important;
  background: var(--grey-50, #FCFCFB);
  border-bottom: 2px solid var(--exeter-yellow) !important;
}
.expanded-grid {
  display: grid;
  grid-template-columns: 2fr 3fr;
  gap: var(--space-2xl);
}
.expanded-col__title {
  font-family: var(--font-heading);
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--charcoal);
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-xs);
  border-bottom: 1px solid var(--grey-200);
}

/* (process-detail / process-meta removed — replaced by process-header strip) */

/* ---- Metric cards (2x4 grid) ---- */
.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-sm);
}
.metric-card {
  border: 1px solid var(--grey-100);
  border-radius: 4px;
  padding: var(--space-sm) var(--space-md);
  background: #fff;
}
.metric-card__label {
  font-family: var(--font-heading);
  font-size: 0.55rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--charcoal);
  margin-bottom: 2px;
}
.metric-card__value {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 900;
  color: var(--near-black);
  line-height: 1.2;
}
.metric-card__value--tbc {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--grey-300);
}
.metric-card__footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 4px;
}
.metric-card__source {
  font-size: 0.6rem;
  color: var(--grey-400);
}

/* ---- Status pills ---- */
.status-pill {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 8px;
  font-family: var(--font-heading);
  font-size: 0.55rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.status-pill--exists { background: #D8FFFE; color: #006A69; }
.status-pill--needs-capture { background: #FFD8F6; color: #950071; }
.status-pill--tbc { background: var(--grey-100); color: var(--grey-400); }

/* ---- Ambition fields ---- */
.ambition-fields {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}
.ambition-field {
  border-left: 3px solid var(--grey-200);
  padding-left: var(--space-md);
}
.ambition-field__label {
  font-family: var(--font-heading);
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--charcoal);
  margin-bottom: 2px;
}
.ambition-field__value {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.5;
}
.ambition-field__value--empty {
  color: var(--grey-300);
  font-style: italic;
}

/* Linked complaints list */
.complaint-links {
  margin-top: var(--space-md);
}
.complaint-links__title {
  font-family: var(--font-heading);
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--charcoal);
  margin-bottom: var(--space-xs);
}
.complaint-links__list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.complaint-links__list li {
  font-size: 0.75rem;
  color: var(--charcoal);
  padding: 2px 0;
  padding-left: 12px;
  position: relative;
}
.complaint-links__list li::before {
  content: '\2022';
  position: absolute;
  left: 0;
  color: var(--grey-300);
}
.complaint-links__empty {
  font-size: 0.75rem;
  color: var(--grey-300);
  font-style: italic;
}
.complaint-id {
  display: inline-block;
  padding: 0 4px;
  border-radius: 2px;
  background: var(--grey-100);
  font-family: var(--font-heading);
  font-size: 0.55rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--grey-400);
  vertical-align: middle;
  margin-right: 2px;
}
.complaint-vol {
  display: inline-block;
  margin-left: 6px;
  padding: 0 5px;
  border-radius: 3px;
  background: var(--grey-100);
  font-family: var(--font-heading);
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--charcoal);
  vertical-align: middle;
}

/* (data-avail sub-table removed — metric cards now serve as single source) */

/* ---- Edit mode button ---- */
.edit-bar {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}
.edit-btn {
  font-family: var(--font-heading);
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 5px 14px;
  border-radius: 4px;
  border: 1px solid var(--grey-200);
  background: #fff;
  color: var(--charcoal);
  cursor: pointer;
  transition: all 0.15s ease;
}
.edit-btn:hover { border-color: var(--charcoal); }
.edit-btn--save {
  background: var(--near-black);
  color: #fff;
  border-color: var(--near-black);
}
.edit-btn--save:hover { background: var(--charcoal); }
.edit-btn--cancel {
  background: #fff;
  color: var(--grey-400);
}

/* ---- Process header strip ---- */
.process-header {
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--grey-200);
}
.process-header__text {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: var(--space-sm);
}
.process-header__meta {
  display: flex;
  gap: var(--space-lg);
  flex-wrap: wrap;
  align-items: center;
}
.process-header__meta-item {
  display: flex;
  align-items: center;
  gap: 4px;
}
.process-header__meta-label {
  font-family: var(--font-heading);
  font-size: 0.55rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--grey-400);
}
.process-header__meta-value {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--near-black);
}

/* ---- Edit mode inputs ---- */
.metric-card--editing {
  border-color: var(--exeter-yellow);
  background: rgba(255, 237, 0, 0.04);
}
.metric-card__input {
  width: 100%;
  padding: 3px 6px;
  border: 1px solid var(--grey-200);
  border-radius: 3px;
  font-family: var(--font-heading);
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--near-black);
  background: #fff;
  outline: none;
  transition: border-color 0.15s ease;
}
.metric-card__input:focus { border-color: var(--exeter-yellow); }
.metric-card__input--sm {
  font-size: 0.6875rem;
  font-weight: 400;
  padding: 2px 6px;
  margin-top: 2px;
}
.metric-card__edit-row {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 3px;
}
.metric-card__edit-label {
  font-size: 0.55rem;
  color: var(--grey-400);
  white-space: nowrap;
  min-width: 38px;
}
.ambition-field__textarea {
  width: 100%;
  min-height: 48px;
  padding: 6px 8px;
  border: 1px solid var(--grey-200);
  border-radius: 3px;
  font-family: var(--font-body);
  font-size: 0.8125rem;
  color: var(--charcoal);
  line-height: 1.5;
  resize: vertical;
  outline: none;
}
.ambition-field__textarea:focus { border-color: var(--exeter-yellow); }
.ambition-field--editing { border-left-color: var(--exeter-yellow); }
.demand-select {
  padding: 4px 8px;
  border: 1px solid var(--grey-200);
  border-radius: 3px;
  font-family: var(--font-heading);
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--charcoal);
  background: #fff;
  cursor: pointer;
  outline: none;
}
.demand-select:focus { border-color: var(--exeter-yellow); }

/* ---- Process flow (view mode) ---- */
.process-flow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-xs);
  margin-bottom: var(--space-lg);
}
.process-flow__step {
  padding: 6px 12px;
  background: #fff;
  border: 1px solid var(--grey-200);
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--charcoal);
  line-height: 1.3;
}
.process-flow__arrow {
  color: var(--grey-300);
  font-size: 0.875rem;
}
.process-flow__empty {
  font-size: 0.75rem;
  color: var(--grey-300);
  font-style: italic;
  margin-bottom: var(--space-lg);
}

/* ---- Flow editor (edit mode) ---- */
.flow-editor {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-xs);
  margin-bottom: var(--space-lg);
}
.flow-editor__step {
  display: flex;
  align-items: center;
  gap: 2px;
  background: rgba(255, 237, 0, 0.04);
  border: 1px solid var(--exeter-yellow);
  border-radius: 4px;
  padding: 2px;
}
.flow-editor__step input {
  padding: 4px 8px;
  border: none;
  background: transparent;
  font-family: var(--font-body);
  font-size: 0.75rem;
  color: var(--charcoal);
  outline: none;
  min-width: 100px;
  width: auto;
}
.flow-editor__remove {
  width: 20px;
  height: 20px;
  border: none;
  background: transparent;
  color: var(--grey-400);
  font-size: 0.875rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 2px;
  padding: 0;
  line-height: 1;
}
.flow-editor__remove:hover {
  background: #FFD8F6;
  color: #950071;
}
.flow-editor__add {
  padding: 5px 12px;
  border: 1px dashed var(--grey-300);
  border-radius: 4px;
  background: transparent;
  font-family: var(--font-heading);
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--grey-400);
  cursor: pointer;
  transition: all 0.15s ease;
}
.flow-editor__add:hover {
  border-color: var(--charcoal);
  color: var(--charcoal);
}

/* ---- Ambition number cards ---- */
.ambition-numbers {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
}
.ambition-number {
  border: 1px solid var(--grey-100);
  border-radius: 4px;
  padding: var(--space-sm) var(--space-md);
  background: #fff;
  text-align: center;
}
.ambition-number__label {
  font-family: var(--font-heading);
  font-size: 0.55rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--charcoal);
  margin-bottom: 2px;
}
.ambition-number__desc {
  font-size: 0.6rem;
  color: var(--grey-400);
  margin-bottom: 4px;
}
.ambition-number__value {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 900;
  color: var(--near-black);
  line-height: 1.2;
}
.ambition-number__value--empty {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--grey-300);
}
.ambition-number--editing {
  border-color: var(--exeter-yellow);
  background: rgba(255, 237, 0, 0.04);
}
.ambition-number__input {
  width: 100%;
  text-align: center;
  padding: 3px 6px;
  border: 1px solid var(--grey-200);
  border-radius: 3px;
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
  color: var(--near-black);
  background: #fff;
  outline: none;
}
.ambition-number__input:focus { border-color: var(--exeter-yellow); }

/* ---- Complexity badge ---- */
.complexity-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 3px;
  font-family: var(--font-heading);
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.complexity-badge--low { background: #D8FFFE; color: #006A69; }
.complexity-badge--medium { background: #E9D8FF; color: #410095; }
.complexity-badge--high { background: #FFD8F6; color: #950071; }
.complexity-badge--very-high { background: #FFB1EC; color: #6A0051; }
.complexity-badge--tbc { background: var(--grey-100); color: var(--grey-400); }

/* ---- Empty state ---- */
.empty-state {
  text-align: center;
  padding: var(--space-3xl) var(--space-xl);
  color: var(--grey-300);
}
.empty-state__text {
  font-size: 0.9375rem;
  margin-top: var(--space-sm);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1100px) {
  .expanded-grid { grid-template-columns: 1fr; }
  .ambition-numbers { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 900px) {
  .app-layout { padding: 0 var(--space-lg) var(--space-2xl); }
  .coverage-bars { grid-template-columns: 1fr; }
  .coverage-bar { grid-template-columns: 110px 1fr 40px; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .wiki-header__title { font-size: 1.5rem; }
  .wiki-stat-row { gap: var(--space-lg); }
  .metric-grid { grid-template-columns: 1fr; }
  .ambition-numbers { grid-template-columns: 1fr; }
  .filter-results { margin-left: 0; width: 100%; margin-top: var(--space-xs); }
}
