:root {
  --bg: #f7f3ef;
  --panel: #ffffff;
  --panel-soft: #fbfaf8;
  --surface: #f0ebe6;
  --text: #1a1717;
  --muted: #746c66;
  --line: #ded7d0;
  --accent: #b40012;
  --accent-2: #111111;
  --ok: #167d4b;
  --warn: #a96800;
  --danger: #b40012;
  --shadow: 0 18px 40px rgba(42, 26, 20, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    linear-gradient(90deg, rgba(180, 0, 18, 0.06) 0 1px, transparent 1px 100%),
    linear-gradient(180deg, rgba(20, 17, 17, 0.04) 0 1px, transparent 1px 100%),
    var(--bg);
  background-size: 28px 28px;
  color: var(--text);
  font-family: 'Avenir Next', 'SF Pro Text', 'Segoe UI', sans-serif;
  min-height: 100vh;
}

button,
input,
select,
textarea {
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--text);
  border-radius: 6px;
  padding: 0.55rem 0.75rem;
  font-size: 0.95rem;
}

button {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
  cursor: pointer;
  font-weight: 650;
  transition: transform 120ms ease, background 120ms ease, box-shadow 120ms ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(180, 0, 18, 0.16);
}

button.mini {
  font-size: 0.78rem;
  margin-right: 0.35rem;
  padding: 0.35rem 0.5rem;
}

button.danger {
  border-color: var(--danger);
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  width: 100%;
}

a {
  color: var(--accent);
}

#app {
  min-height: 100vh;
  padding: 1.1rem;
}

.auth-shell {
  display: grid;
  place-items: center;
  min-height: calc(100vh - 2.2rem);
}

.auth-card {
  width: min(760px, 100%);
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 1.5rem;
}

.auth-card.wide {
  max-width: 1100px;
}

.auth-brand {
  display: flex;
  justify-content: center;
  margin-bottom: 0.8rem;
}

.auth-brand img {
  display: block;
  width: min(300px, 82vw);
  height: auto;
  object-fit: contain;
}

.lobby-brand img {
  width: min(260px, 70vw);
}

.form {
  display: grid;
  gap: 0.7rem;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

.shell {
  display: grid;
  grid-template-columns: 250px 1fr;
  gap: 1rem;
}

.sidebar {
  background: #151212;
  border: 1px solid #2a2424;
  border-radius: 8px;
  padding: 0.8rem;
  min-height: calc(100vh - 2.2rem);
}

.nav-header,
.side-header {
  margin-bottom: 0.6rem;
}

.nav-list {
  display: grid;
  gap: 0.35rem;
}

.nav-btn,
.ghost {
  border-radius: 6px;
  width: 100%;
  padding: 0.58rem;
  color: #f7f3ef;
  background: transparent;
  border: 1px solid transparent;
  text-align: left;
}

.nav-btn.active,
.nav-btn:hover {
  background: rgba(180, 0, 18, 0.25);
  border-color: rgba(255, 255, 255, 0.16);
  box-shadow: none;
}

.side-logo {
  display: block;
  width: 58px;
  height: 58px;
  object-fit: contain;
  border-radius: 8px;
  margin-bottom: 0.75rem;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.85rem 1rem;
  margin-bottom: 1rem;
  box-shadow: 0 10px 22px rgba(42, 26, 20, 0.06);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-width: 220px;
}

.top-logo {
  width: 42px;
  height: 42px;
  object-fit: contain;
  border-radius: 8px;
}

.topbar h1 {
  margin: 0;
  font-size: clamp(1.1rem, 2.3vw, 1.65rem);
}

.topbar p,
.topbar .user {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.badges {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.badge {
  padding: 0.28rem 0.5rem;
  border-radius: 999px;
  font-size: 0.74rem;
  color: var(--accent-2);
  background: #fff7f4;
  border: 1px solid #f1cbc5;
}

.badge.owner {
  background: #edf8f1;
  border-color: #c2e5ce;
  color: var(--ok);
}

.badge.warn {
  background: #fff4db;
  border-color: #f4d086;
  color: var(--warn);
}

main {
  min-height: calc(100vh - 2.2rem);
}

.module-head {
  margin-bottom: 0.8rem;
}

.module-head h2 {
  margin: 0;
}

.module-head p,
.module-head .sub {
  margin: 0.35rem 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.85rem;
  margin-bottom: 0.9rem;
  box-shadow: 0 10px 24px rgba(42, 26, 20, 0.05);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.8rem;
}

.pitch-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(260px, 0.75fr);
  gap: 0.85rem;
  align-items: stretch;
  margin-bottom: 0.9rem;
}

.pitch-hero > div,
.risk-card {
  background:
    linear-gradient(135deg, rgba(180, 0, 18, 0.08), rgba(255, 255, 255, 0.92)),
    #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1rem;
  box-shadow: 0 10px 24px rgba(42, 26, 20, 0.05);
}

.pitch-hero h3 {
  margin: 0.25rem 0 0.45rem;
  font-size: clamp(1.25rem, 2vw, 1.8rem);
}

.eyebrow {
  display: inline-flex;
  width: fit-content;
  border: 1px solid #efcac2;
  border-radius: 999px;
  color: #6f1b1f;
  background: #fff3f0;
  font-size: 0.75rem;
  font-weight: 750;
  letter-spacing: 0.04em;
  padding: 0.2rem 0.5rem;
  text-transform: uppercase;
}

.risk-card {
  display: grid;
  align-content: start;
  gap: 0.35rem;
}

.risk-card span {
  color: var(--muted);
  font-size: 0.8rem;
}

.risk-card strong {
  color: var(--accent);
  font-size: 1.45rem;
}

.risk-card small {
  color: var(--muted);
  line-height: 1.35;
}

.risk-card ul {
  margin: 0.25rem 0 0;
  padding-left: 1.05rem;
}

.language-panel {
  background: #151212;
  color: #f7f3ef;
  border-color: #2a2424;
}

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

.language-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.5rem;
}

.language-grid span {
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  border-radius: 6px;
  padding: 0.55rem;
  font-weight: 700;
}

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

.wide-panel {
  grid-column: 1 / -1;
}

.depth-grid,
.mini-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 0.55rem;
}

.depth-btn {
  display: grid;
  gap: 0.2rem;
  text-align: left;
  background: #ffffff;
  color: var(--text);
  border-color: var(--line);
}

.depth-btn.active {
  background: #151212;
  color: #ffffff;
  border-color: #151212;
}

.depth-btn small {
  color: inherit;
  opacity: 0.72;
}

.mini-panel {
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.75rem;
}

.mini-panel h4 {
  margin: 0 0 0.4rem;
}

.mini-panel ul,
.objection,
.recommendation ul {
  margin: 0;
  padding-left: 1rem;
}

.stack {
  display: grid;
  gap: 0.55rem;
}

.objection {
  display: grid;
  gap: 0.25rem;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.7rem;
}

.recommendation {
  min-height: 74px;
  border: 1px dashed #d4c8bf;
  border-radius: 8px;
  padding: 0.7rem;
  background: #fffaf8;
}

.compact li {
  margin-bottom: 0.2rem;
}

.hidden {
  display: none !important;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(21, 18, 18, 0.58);
}

.modal-card {
  width: min(720px, 100%);
  max-height: min(88vh, 820px);
  overflow: auto;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(21, 18, 18, 0.32);
  padding: 1.1rem;
}

.credential-grid {
  display: grid;
  grid-template-columns: minmax(140px, 0.45fr) 1fr;
  gap: 0.45rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.75rem;
  background: var(--panel-soft);
}

.credential-grid span {
  color: var(--muted);
}

.credential-grid strong {
  overflow-wrap: anywhere;
}

.card {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.8rem;
  box-shadow: 0 9px 20px rgba(42, 26, 20, 0.05);
}

.card-title {
  color: var(--muted);
  font-size: 0.8rem;
}

.card-value {
  font-size: 1.85rem;
  font-weight: 700;
  margin-top: 0.45rem;
}

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

.table-wrap {
  overflow: auto;
  border-radius: 8px;
  border: 1px solid var(--line);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

th,
td {
  text-align: left;
  border-bottom: 1px solid var(--line);
  padding: 0.6rem;
  vertical-align: top;
}

th {
  color: #2d2827;
  background: #f3eee9;
  position: sticky;
  top: 0;
}

tbody tr:hover {
  background: #fff8f7;
}

.toast {
  position: fixed;
  right: 14px;
  bottom: 16px;
  background: #151212;
  border: 1px solid #332b2b;
  color: #fff;
  border-radius: 8px;
  padding: 0.7rem 0.9rem;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 120ms ease, transform 120ms ease;
  max-width: min(92vw, 420px);
  pointer-events: none;
}

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

.toast.error {
  border-color: var(--danger);
  background: #3a080d;
}

.toast.warning {
  border-color: #f4c45f;
  background: #3a2707;
}

.toast.success {
  border-color: #5acb86;
  background: #0d3321;
}

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

select,
input,
textarea {
  max-width: 100%;
}

select[multiple] {
  min-height: 110px;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  list-style: none;
  padding: 0;
  margin: 0.5rem 0;
}

.chip-list li {
  background: #fff3f0;
  border: 1px solid #efcac2;
  color: #6f1b1f;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
}

.list {
  margin: 0;
  padding: 0 1rem;
}

.list li {
  margin-bottom: 0.4rem;
}

pre {
  margin: 0;
  max-width: 380px;
  white-space: pre-wrap;
  word-break: break-word;
}

.select-card {
  background: #ffffff;
  border-radius: 8px;
  border: 1px solid var(--line);
  padding: 0.95rem;
  box-shadow: 0 10px 22px rgba(42, 26, 20, 0.06);
}

.select-card h3 {
  margin: 0;
}

.select-card .small {
  color: var(--muted);
  margin: 0.4rem 0;
}

.select-card button {
  margin-top: 0.5rem;
}

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

  .sidebar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: start;
    gap: 0.5rem;
    min-height: auto;
  }

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

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

  .pitch-hero,
  .pitch-grid {
    grid-template-columns: 1fr;
  }
}

button.secondary {
  background: #ffffff;
  border-color: var(--line);
  color: var(--text);
}

button.ghost-light {
  background: #f7f7f7;
  border-color: var(--line);
  color: var(--muted);
}

.email-choice-card {
  max-width: 560px;
}

.email-choice-card .eyebrow {
  margin: 0 0 0.4rem;
  color: var(--accent);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
