:root {
  --app-bg: #f4f6f2;
  --surface: #ffffff;
  --surface-soft: #f9faf7;
  --ink: #17201b;
  --muted: #66706a;
  --line: #dfe4dc;
  --line-strong: #c8d2c7;
  --primary: #146c5c;
  --primary-dark: #0d4d42;
  --primary-soft: #e5f3ef;
  --accent: #b94d35;
  --accent-soft: #f8e9e5;
  --gold: #a77a18;
  --gold-soft: #fbf1d7;
  --shadow-sm: 0 8px 22px rgba(23, 32, 27, 0.06);
  --shadow-md: 0 18px 42px rgba(23, 32, 27, 0.09);
}

* {
  letter-spacing: 0;
}

body {
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(20, 108, 92, 0.08), transparent 300px),
    var(--app-bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

.app-nav {
  background: rgba(255, 255, 255, 0.9);
  border-bottom: 1px solid rgba(200, 210, 199, 0.8);
  backdrop-filter: blur(16px);
}

.app-nav-inner {
  max-width: 1440px;
  padding: 12px 24px;
}

.app-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 750;
}

.brand-mark {
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  font-size: 0.78rem;
  box-shadow: 0 10px 18px rgba(20, 108, 92, 0.2);
}

.app-tabs {
  gap: 4px;
  margin-left: 28px;
}

.app-tabs .nav-link,
.nav-actions .btn,
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.app-tabs .nav-link {
  min-height: 38px;
  border-radius: 8px;
  color: var(--muted);
  font-weight: 650;
  padding: 8px 12px;
}

.app-tabs .nav-link:hover {
  background: var(--primary-soft);
  color: var(--primary-dark);
  text-decoration: none;
}

.app-tabs svg,
.nav-actions svg,
.dropdown-item svg,
.dropdown-item-text svg,
.btn svg {
  width: 16px;
  height: 16px;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.access-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
}

.access-pill.unlocked {
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.profile-toggle {
  max-width: min(280px, 70vw);
  padding: 5px 10px 5px 6px;
}

.profile-avatar {
  display: inline-grid;
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 800;
}

.profile-name {
  min-width: 0;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-dropdown {
  min-width: 230px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-md);
}

.profile-dropdown .dropdown-item,
.profile-dropdown .dropdown-item-text {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 38px;
  border-radius: 8px;
  color: #39443e;
  font-weight: 700;
}

.profile-dropdown .dropdown-item:hover,
.profile-dropdown .dropdown-item:focus {
  background: var(--primary-soft);
  color: var(--primary-dark);
  text-decoration: none;
}

.profile-dropdown .dropdown-divider {
  margin: 8px 0;
}

.access-line {
  color: var(--primary-dark);
}

.signout-item {
  width: 100%;
}

.app-shell {
  max-width: 1440px;
  padding: 28px 24px 48px;
}

.messages {
  max-width: 960px;
  margin-bottom: 18px;
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  margin-bottom: 18px;
}

.eyebrow {
  color: var(--primary-dark);
  font-size: 0.78rem;
  font-weight: 800;
  margin-bottom: 6px;
  text-transform: uppercase;
}

.page-title {
  margin: 0;
  font-size: clamp(1.65rem, 2vw, 2.25rem);
  font-weight: 780;
}

.page-copy {
  max-width: 760px;
  margin: 6px 0 0;
  color: var(--muted);
}

.panel,
.auth-panel,
.billing-panel {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
}

.panel {
  padding: 20px;
}

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

.panel-title {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  font-size: 1rem;
  font-weight: 760;
}

.panel-title svg {
  width: 18px;
  height: 18px;
  color: var(--primary);
}

.btn {
  border-radius: 8px;
  font-weight: 700;
  min-height: 38px;
}

.btn-primary {
  --bs-btn-bg: var(--primary);
  --bs-btn-border-color: var(--primary);
  --bs-btn-hover-bg: var(--primary-dark);
  --bs-btn-hover-border-color: var(--primary-dark);
  --bs-btn-active-bg: var(--primary-dark);
  --bs-btn-active-border-color: var(--primary-dark);
  box-shadow: 0 10px 20px rgba(20, 108, 92, 0.18);
}

.btn-secondary {
  --bs-btn-bg: #26352d;
  --bs-btn-border-color: #26352d;
  --bs-btn-hover-bg: #17201b;
  --bs-btn-hover-border-color: #17201b;
}

.btn-outline-primary {
  --bs-btn-color: var(--primary);
  --bs-btn-border-color: #98b9af;
  --bs-btn-hover-bg: var(--primary);
  --bs-btn-hover-border-color: var(--primary);
}

.btn-outline-secondary {
  --bs-btn-color: #4f5a54;
  --bs-btn-border-color: #c6d0c8;
  --bs-btn-hover-bg: #edf1eb;
  --bs-btn-hover-border-color: #aebbae;
  --bs-btn-hover-color: var(--ink);
}

.form-label,
.auth-panel label,
.panel label {
  color: #2b352f;
  font-weight: 720;
  font-size: 0.84rem;
}

.form-control,
.form-select,
.auth-panel input,
.auth-panel select,
.auth-panel textarea,
.panel input,
.panel select,
.panel textarea {
  display: block;
  width: 100%;
  min-height: 42px;
  padding: 0.58rem 0.75rem;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  box-shadow: none;
}

.form-control:focus,
.form-select:focus,
.auth-panel input:focus,
.auth-panel select:focus,
.auth-panel textarea:focus,
.panel input:focus,
.panel select:focus,
.panel textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(20, 108, 92, 0.12);
}

.search-panel {
  padding: 14px;
  margin-bottom: 18px;
}

.search-panel .form-control {
  min-height: 46px;
}

.profile-panel {
  position: sticky;
  top: 86px;
}

.profile-panel p {
  margin-bottom: 12px;
}

.profile-panel textarea {
  resize: vertical;
}

.profile-stack {
  display: grid;
  gap: 18px;
}

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

.readonly-field {
  min-height: 74px;
  padding: 12px;
  border: 1px solid #e5e9e2;
  border-radius: 8px;
  background: var(--surface-soft);
}

.readonly-field span {
  display: block;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
}

.readonly-field strong {
  display: block;
  margin-top: 6px;
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 740;
  overflow-wrap: anywhere;
}

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

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

.field-wide,
.startup-profile-panel {
  grid-column: 1 / -1;
}

.profile-form textarea {
  resize: vertical;
}

.investor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 16px;
}

.investor-card,
.target-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.investor-card:hover,
.target-card:hover {
  transform: translateY(-2px);
  border-color: #b7c7bc;
  box-shadow: var(--shadow-md);
}

.investor-card .card-body,
.target-card .card-body {
  padding: 18px;
}

.card-kicker {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 26px;
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
  color: #4b5850;
  font-size: 0.76rem;
  font-weight: 700;
}

.chip.primary {
  border-color: #b9d5cd;
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.chip.warning {
  border-color: #eed8a6;
  background: var(--gold-soft);
  color: #76550d;
}

.investor-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 760;
  line-height: 1.3;
}

.investor-desc {
  min-height: 64px;
  margin: 14px 0;
  color: #4f5a54;
  font-size: 0.92rem;
  line-height: 1.5;
}

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

.metric {
  min-height: 58px;
  padding: 9px 10px;
  border: 1px solid #e5e9e2;
  border-radius: 8px;
  background: var(--surface-soft);
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 750;
  text-transform: uppercase;
}

.metric strong {
  display: block;
  margin-top: 3px;
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 740;
  overflow-wrap: anywhere;
}

.empty-state {
  background: var(--surface);
  border: 1px dashed #aebbae;
  border-radius: 8px;
  padding: 34px;
  color: var(--muted);
  box-shadow: var(--shadow-sm);
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(320px, 0.8fr);
  gap: 24px;
}

.detail-list {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 12px 18px;
  margin: 18px 0 0;
}

.detail-list dt {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.detail-list dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.contact-block,
.doc-row {
  border-top: 1px solid #e5e9e2;
  padding-top: 14px;
  margin-top: 14px;
}

.contact-block:first-of-type,
.doc-row:first-of-type {
  border-top: 0;
  padding-top: 0;
  margin-top: 0;
}

.doc-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.doc-name {
  font-weight: 760;
  overflow-wrap: anywhere;
}

.status-dot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 0.82rem;
}

.billing-panel {
  max-width: 560px;
  margin: 48px auto;
  padding: 28px;
}

.price-box {
  border: 1px solid #cdd9d0;
  border-radius: 8px;
  padding: 22px;
  margin: 22px 0;
  background: linear-gradient(135deg, #f6fbf8, #fff);
}

.price {
  font-size: 2.45rem;
  font-weight: 820;
  margin-right: 8px;
}

.draft-result {
  white-space: pre-wrap;
  background: #fbfcfa;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  line-height: 1.55;
}

.draft-history {
  border-top: 1px solid #e5e9e2;
  padding: 12px 0;
}

.draft-history summary {
  cursor: pointer;
  font-weight: 720;
}

.draft-edit-form {
  display: grid;
  gap: 10px;
  margin: 12px 0 0;
}

.draft-edit-form textarea {
  min-height: 190px;
  resize: vertical;
}

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

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

.draft-history pre {
  white-space: pre-wrap;
  color: #354039;
}

.auth-wrap {
  min-height: calc(100vh - 90px);
  display: grid;
  place-items: center;
  padding: 28px 0;
}

.auth-panel {
  width: min(100%, 470px);
  padding: 28px;
  box-shadow: var(--shadow-md);
}

.auth-panel h1 {
  font-weight: 800;
}

.auth-panel p {
  margin-bottom: 12px;
}

.auth-links {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 0.92rem;
}

.required-mark {
  color: #b42318;
  font-weight: 800;
}

.form-help {
  color: var(--muted);
  font-size: 0.82rem;
  margin-top: 4px;
}

.form-error {
  color: #b42318;
  font-size: 0.85rem;
  margin-top: 4px;
}

.form-error ul {
  margin: 0;
  padding-left: 18px;
}

@media (max-width: 1199px) {
  .profile-panel {
    position: static;
  }
}

@media (max-width: 991px) {
  .app-tabs {
    margin-left: 0;
    margin-top: 12px;
  }

  .nav-actions {
    margin-top: 12px;
    justify-content: flex-start;
  }

  .page-head,
  .detail-grid {
    display: block;
  }

  .page-head .btn {
    margin-top: 14px;
  }

}

@media (max-width: 575px) {
  .app-nav-inner,
  .app-shell {
    padding-left: 16px;
    padding-right: 16px;
  }

  .investor-grid,
  .metric-grid,
  .profile-form-grid,
  .readonly-grid {
    grid-template-columns: 1fr;
  }

  .detail-list {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}
