/* BuildMatch app shell — forest/signal system */

.app-shell {
  min-height: 100vh;
  background: var(--paper, #f3f5f2);
  font-family: var(--font-sans, "Manrope", system-ui, sans-serif);
}

.app-topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(243, 245, 242, 0.94);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line, #d7ddd6);
}

.app-topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 64px;
}

.app-nav {
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
}

@media (max-width: 640px) {
  .app-topbar-inner {
    flex-wrap: wrap;
    align-items: flex-start;
    padding: 0.65rem 0;
  }

  .app-nav {
    width: 100%;
    gap: 0.65rem 0.85rem;
  }

  .app-nav a,
  .app-nav button {
    font-size: 0.88rem;
  }
}

.app-nav a {
  text-decoration: none;
  color: var(--ink-soft, #3a433c);
  font-weight: 600;
  font-size: 0.95rem;
}

.app-nav a:hover,
.app-nav a[aria-current="page"] {
  color: var(--ink, #121614);
}

.app-main {
  padding: clamp(1.5rem, 4vw, 2.75rem) 0 4rem;
}

.app-card {
  background: #fff;
  border: 1px solid var(--line, #d7ddd6);
  border-radius: 10px;
  box-shadow: 0 1px 2px rgba(18, 22, 20, 0.06);
  padding: clamp(1.25rem, 3vw, 1.75rem);
}

.app-grid {
  display: grid;
  gap: 1.25rem;
}

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

@media (max-width: 800px) {
  .app-grid.two { grid-template-columns: 1fr; }
}

.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  background: #e7ece6;
  color: #3a433c;
  font-size: 0.85rem;
  font-weight: 700;
}

.status-pill.good {
  background: #d8ebe2;
  color: #0a4330;
}

.wizard-progress {
  display: flex;
  gap: 0.4rem;
  margin: 1rem 0 1.5rem;
  flex-wrap: wrap;
}

.wizard-progress span {
  width: 2rem;
  height: 0.35rem;
  border-radius: 99px;
  background: #d7ddd6;
}

.wizard-progress span.active,
.wizard-progress span.done {
  background: #0f5c42;
}

.progress-rail {
  list-style: none;
  margin: 0;
  padding: 0.85rem 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1.25rem;
  background: #f7f9f6;
  border: 1px solid var(--line, #d7ddd6);
  border-radius: 8px;
}

.progress-step {
  font-size: 0.92rem;
  color: var(--muted, #6a746c);
  font-weight: 600;
}

.progress-step.done { color: #0a4330; }
.progress-step.active { color: #0f5c42; font-weight: 750; }

.reason-list {
  margin: 0.35rem 0 0.65rem;
  padding-left: 0;
  list-style: none;
  color: var(--ink-soft, #3a433c);
}

.reason-list li + li { margin-top: 0.25rem; }

.contractor-sections {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.contractor-sections button {
  border: 1px solid var(--line, #d7ddd6);
  background: #fff;
  border-radius: 999px;
  padding: 0.4rem 0.85rem;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
}

.contractor-sections button.is-active {
  background: #0f5c42;
  border-color: #0f5c42;
  color: #fff;
}

.wizard-step[hidden] { display: none !important; }

.category-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
}

.category-option {
  border: 1px solid #d7ddd6;
  border-radius: 6px;
  background: #fff;
  padding: 0.9rem 0.85rem;
  text-align: left;
  cursor: pointer;
  font: inherit;
}

.category-option[aria-pressed="true"] {
  border-color: #0f5c42;
  box-shadow: inset 0 0 0 1px #0f5c42;
  background: #d8ebe2;
}

.muted { color: #6a746c; }
.stack-sm > * + * { margin-top: 0.75rem; }
.stack-md > * + * { margin-top: 1.25rem; }

.compare-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
}

.compare-table th,
.compare-table td {
  border: 1px solid #d7ddd6;
  padding: 0.75rem;
  text-align: left;
  vertical-align: top;
  background: #fff;
}

.compare-wrap { overflow-x: auto; }

@media (max-width: 720px) {
  .compare-mobile { display: grid; gap: 1rem; }
  .compare-desktop { display: none; }
}
@media (min-width: 721px) {
  .compare-mobile { display: none; }
}

.message-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 360px;
  overflow: auto;
}

.message-bubble {
  max-width: 80%;
  padding: 0.75rem 0.9rem;
  border-radius: 10px;
  background: #e7ece6;
}

.message-bubble.mine {
  margin-left: auto;
  background: #d8ebe2;
}

.skeleton {
  background: linear-gradient(90deg, #e7ece6, #fff, #e7ece6);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite;
  border-radius: 8px;
  min-height: 1rem;
}

@keyframes shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

.empty-state,
.error-state,
.success-state {
  padding: 1rem 1.1rem;
  border-radius: 6px;
  border: 1px solid #d7ddd6;
  background: #e7ece6;
}

.error-state {
  background: #fff5f4;
  border-color: #f0c7c2;
  color: #7a2e28;
}

.success-state {
  background: #e5f3ec;
  border-color: #c9e6d6;
}

.workspace-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  border-bottom: 1px solid #d7ddd6;
  padding-bottom: 0.75rem;
}

.workspace-tabs button {
  border: 0;
  background: transparent;
  font: inherit;
  color: #6a746c;
  padding: 0.45rem 0.7rem;
  border-radius: 999px;
  cursor: pointer;
}

.workspace-tabs button.is-active {
  background: #d8ebe2;
  color: #0a4330;
  font-weight: 700;
}

.workspace-panel h3 { margin-top: 0; }

/* —— P5 product surfaces —— */
.match-card {
  display: grid;
  gap: 0.65rem;
  border: 1px solid var(--line, #d7ddd6);
  border-radius: 12px;
  padding: 1.1rem 1.15rem;
  background: #fff;
  transition: box-shadow 0.2s var(--ease, ease), border-color 0.2s;
}

.match-card:hover {
  border-color: #b8cfc2;
  box-shadow: 0 8px 24px rgba(15, 92, 66, 0.08);
}

.match-card-head {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: flex-start;
}

.match-card h4 {
  margin: 0;
  font-size: 1.08rem;
  font-weight: 750;
}

.match-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.15rem 0 0;
}

.verify-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  background: #eef2ee;
  color: #3a433c;
}

.verify-badge.verified { background: #d8ebe2; color: #0a4330; }
.verify-badge.pending { background: #fff4e5; color: #7a4e12; }

.compare-highlight td {
  background: #f7fbf8;
}

.compare-table th:first-child {
  width: 140px;
  background: #f7f9f6;
  font-weight: 700;
  color: var(--muted, #6a746c);
}

.compare-pro-card {
  border: 1px solid var(--line, #d7ddd6);
  border-radius: 12px;
  padding: 1.1rem;
  background: #fff;
}

.compare-pro-card h3 {
  margin: 0 0 0.75rem;
  font-size: 1.15rem;
}

.compare-row {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 0.5rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--line-soft, #e8ece7);
  font-size: 0.92rem;
}

.compare-row:last-child { border-bottom: 0; }
.compare-row dt { color: var(--muted, #6a746c); font-weight: 600; margin: 0; }
.compare-row dd { margin: 0; }

.opp-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.opp-panel {
  background: #f7f9f6;
  border: 1px solid var(--line, #d7ddd6);
  border-radius: 10px;
  padding: 1rem;
}

.opp-panel h2 {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted, #6a746c);
}

.activity-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.activity-list li {
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--line-soft, #e8ece7);
}

.activity-list li:last-child { border-bottom: 0; }

.field label {
  display: block;
  font-weight: 650;
  font-size: 0.9rem;
  margin-bottom: 0.35rem;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line, #d7ddd6);
  border-radius: 8px;
  padding: 0.65rem 0.75rem;
  background: #fff;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.workspace-tabs button:focus-visible,
.contractor-sections button:focus-visible,
.category-option:focus-visible,
.btn:focus-visible {
  outline: 2px solid rgba(15, 92, 66, 0.45);
  outline-offset: 2px;
  border-color: #0f5c42;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.loading-state {
  padding: 1rem 1.1rem;
  border-radius: 6px;
  border: 1px solid #d7ddd6;
  background: #f7f9f6;
  color: #3a433c;
}

.admin-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.85rem;
}

.admin-stat {
  padding: 0.85rem 1rem;
  border: 1px solid var(--line, #d7ddd6);
  border-radius: 8px;
  background: #fff;
}

.admin-stat strong {
  display: block;
  font-size: 0.82rem;
  color: var(--muted, #6a746c);
  font-weight: 650;
}

.admin-stat span {
  font-size: 1.55rem;
  font-weight: 800;
  line-height: 1.2;
}

.form-grid.two {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.form-grid.three {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

@media (max-width: 768px) {
  .form-grid.two,
  .form-grid.three {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .opp-grid,
  .form-grid.two {
    grid-template-columns: 1fr;
  }
}

.file-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.65rem;
  border-radius: 8px;
  background: #eef2ee;
  font-size: 0.88rem;
  margin: 0.25rem 0.35rem 0.25rem 0;
}

@media (prefers-reduced-motion: reduce) {
  .skeleton { animation: none; }
  .match-card { transition: none; }
}
