:root {
  --bg: #f6f7f3;
  --panel: #ffffff;
  --ink: #17201b;
  --muted: #68716b;
  --line: #dfe5dd;
  --green: #176b4d;
  --green-2: #d8efe5;
  --amber: #c98519;
  --blue: #305f9f;
  --rose: #b94860;
  --shadow: 0 20px 60px rgba(21, 35, 28, 0.09);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(23, 107, 77, 0.1), transparent 32%),
    linear-gradient(315deg, rgba(48, 95, 159, 0.1), transparent 36%),
    var(--bg);
}

button, input, select, textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 28px 22px;
  background: #101915;
  color: #f4f7f1;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

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

.brand-mark {
  width: 46px;
  height: 46px;
}

.brand strong {
  display: block;
  font-size: 18px;
}

.brand span,
.status-box span,
.eyebrow,
.panel-head span {
  color: var(--muted);
  font-size: 13px;
}

.sidebar .brand span,
.sidebar .status-box span {
  color: rgba(244, 247, 241, 0.62);
}

.nav-tabs {
  display: grid;
  gap: 8px;
}

.nav-tab {
  border: 0;
  background: transparent;
  color: rgba(244, 247, 241, 0.72);
  display: flex;
  align-items: center;
  padding: 12px 14px;
  border-radius: 8px;
  text-align: left;
}

.nav-tab.active,
.nav-tab:hover {
  background: rgba(244, 247, 241, 0.1);
  color: #fff;
}

.status-box {
  margin-top: auto;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px;
  border: 1px solid rgba(244, 247, 241, 0.12);
  border-radius: 8px;
}

.status-dot {
  width: 10px;
  height: 10px;
  background: #74d28a;
  border-radius: 50%;
  margin-top: 4px;
  flex: none;
}

main {
  padding: 34px;
  min-width: 0;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 28px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 700;
}

h1, h2, p {
  margin-top: 0;
}

h1 {
  max-width: 780px;
  margin-bottom: 0;
  font-size: clamp(32px, 5vw, 58px);
  line-height: 1;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 20px;
}

.primary-action,
.ghost-button,
.segment {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
}

.primary-action {
  background: var(--green);
  color: #fff;
  font-weight: 750;
}

.primary-action:hover {
  background: #105a3f;
}

.ghost-button,
.segment {
  color: var(--ink);
  background: #edf1eb;
}

.notice {
  padding: 14px 16px;
  border: 1px solid #d9e5dc;
  background: #f9fbf8;
  border-radius: 8px;
  color: #445049;
  margin-bottom: 18px;
  line-height: 1.45;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.layout-grid,
.account-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(360px, 0.85fr);
  gap: 18px;
}

.panel {
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(212, 220, 210, 0.9);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.form-panel,
.panel {
  padding: 20px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}

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

.field-row:has(label:nth-child(3)) {
  grid-template-columns: 1.1fr 0.95fr 0.8fr;
}

label {
  display: grid;
  gap: 7px;
  color: #344039;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 14px;
}

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 8px;
  padding: 12px 12px;
  min-height: 44px;
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(23, 107, 77, 0.13);
}

.section-label {
  margin: 18px 0 12px;
  color: var(--green);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.form-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.row-actions {
  display: grid;
  gap: 8px;
}

.match-stack,
.match-table {
  display: grid;
  gap: 12px;
}

.match-card,
.match-row,
.conversation-item {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
}

.match-card {
  padding: 14px;
}

.match-row {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 14px;
}

.score-ring {
  width: 70px;
  aspect-ratio: 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: conic-gradient(var(--green) calc(var(--score) * 1%), #e8eee6 0);
  position: relative;
  font-weight: 850;
}

.score-ring::before {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: inherit;
  background: #fff;
}

.score-ring span {
  position: relative;
}

.match-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.match-title strong {
  font-size: 16px;
}

.badge {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  border-radius: 999px;
  padding: 0 10px;
  background: var(--green-2);
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
}

.badge.near {
  background: #fff2d8;
  color: #8c5b09;
}

.trust-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 8px 0 10px;
}

.trust-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  background: #eef3f7;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
}

.trust-badge.warn {
  background: #fff2d8;
  color: #8c5b09;
}

.trust-badge.ok {
  background: var(--green-2);
  color: var(--green);
}

.match-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  color: #4f5b54;
  font-size: 13px;
}

.match-details div {
  padding: 10px;
  background: #f7f9f5;
  border-radius: 8px;
}

.muted {
  color: var(--muted);
}

.locked {
  filter: blur(3px);
  user-select: none;
}

.locked-note {
  margin-top: 10px;
  color: var(--rose);
  font-size: 13px;
  font-weight: 800;
}

.segmented {
  display: flex;
  gap: 6px;
  padding: 4px;
  background: #edf1eb;
  border-radius: 8px;
}

.segment {
  min-height: 34px;
  background: transparent;
}

.segment.active {
  background: #fff;
  box-shadow: 0 4px 16px rgba(20, 30, 24, 0.08);
}

.chat-layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 18px;
}

.conversation-list {
  display: grid;
  gap: 10px;
  align-content: start;
}

.conversation-item {
  width: 100%;
  padding: 12px;
  text-align: left;
  background: #fff;
}

.conversation-item.active {
  outline: 3px solid rgba(23, 107, 77, 0.17);
  border-color: var(--green);
}

.conversation-item strong,
.conversation-item span {
  display: block;
}

.conversation-item span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.messages {
  min-height: 430px;
  max-height: 55vh;
  overflow: auto;
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 14px;
  background: #f4f7f2;
  border-radius: 8px;
  border: 1px solid var(--line);
}

.readiness-panel {
  margin-top: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.readiness-panel h3 {
  margin: 0 0 10px;
  font-size: 15px;
}

.readiness-panel p {
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

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

.readiness-check {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 10px;
  border-radius: 8px;
  background: #f7f9f5;
  color: #3c4841;
  font-size: 13px;
  font-weight: 650;
}

.readiness-check input {
  width: 18px;
  min-height: 18px;
  margin-top: 1px;
  accent-color: var(--green);
}

.message {
  max-width: min(620px, 86%);
  padding: 10px 12px;
  border-radius: 8px;
  background: #fff;
  line-height: 1.4;
}

.message.mine {
  justify-self: end;
  background: var(--green);
  color: #fff;
}

.chat-compose {
  margin-top: 12px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.price-box {
  padding: 18px;
  border-radius: 8px;
  background: #f7f9f5;
}

.price {
  display: block;
  font-size: 34px;
  font-weight: 900;
  line-height: 1;
  overflow-wrap: anywhere;
}

dialog {
  border: 0;
  border-radius: 8px;
  padding: 0;
  max-width: min(620px, calc(100vw - 28px));
  box-shadow: 0 30px 90px rgba(10, 20, 14, 0.32);
}

dialog::backdrop {
  background: rgba(16, 25, 21, 0.48);
}

.auth-card {
  padding: 20px;
  background: #fff;
}

button:disabled,
input:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

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

.check-list div {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  color: #435049;
}

.check-list span {
  color: var(--green);
  font-weight: 900;
}

.empty-state {
  min-height: 260px;
  display: grid;
  place-items: center;
  text-align: center;
  gap: 8px;
  color: var(--muted);
}

.empty-state img {
  width: 118px;
  height: 118px;
}

.empty-state strong {
  color: var(--ink);
  font-size: 18px;
}

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

  .sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
  }

  .nav-tabs {
    display: flex;
    overflow-x: auto;
  }

  .status-box {
    margin-top: 0;
    margin-left: auto;
  }

  .layout-grid,
  .account-grid,
  .chat-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  main {
    padding: 18px;
  }

  .topbar {
    display: grid;
  }

  .field-row,
  .field-row:has(label:nth-child(3)),
  .match-row,
  .match-details,
  .chat-compose,
  .readiness-checks {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 34px;
  }

  .sidebar {
    padding: 18px;
  }
}

/* ── Stripe unlock ─────────────────────────────────── */
.stripe-unlock {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #635bff;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s;
}
.stripe-unlock:hover { background: #4b44e0; }

.unlock-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  color: #fff;
  border-radius: 10px;
  padding: 20px 24px;
  margin-bottom: 16px;
}
.unlock-banner p {
  margin: 4px 0 0;
  font-size: 13px;
  opacity: 0.8;
}
.unlock-banner strong { font-size: 16px; }
