:root {
  --bg: #f4f6fb;
  --ink: #141821;
  --muted: #657082;
  --line: #dce2ea;
  --panel: #ffffff;
  --panel-2: #f1f6ff;
  --green: #00a676;
  --green-dark: #057451;
  --red: #d94f5c;
  --gold: #f6b84b;
  --blue: #4357ff;
  --teal: #16c7b7;
  --purple: #7b61ff;
  --shadow: 0 22px 60px rgba(27, 35, 50, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, #111827 0, #1d2637 230px, var(--bg) 231px);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

button {
  cursor: pointer;
}

.shell {
  min-height: 100vh;
}

.topbar {
  align-items: center;
  background: rgba(14, 22, 36, 0.92);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  color: white;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  padding: 18px clamp(18px, 4vw, 42px);
}

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

.mark {
  align-items: center;
  background: linear-gradient(135deg, var(--teal), var(--gold));
  border-radius: 6px;
  color: #111827;
  display: grid;
  font-weight: 900;
  height: 36px;
  place-items: center;
  width: 36px;
}

.brand h1 {
  font-size: 1.05rem;
  line-height: 1.1;
  margin: 0;
}

.brand p {
  color: #bac5d6;
  font-size: 0.82rem;
  margin: 3px 0 0;
}

.userbar {
  align-items: center;
  display: flex;
  gap: 12px;
}

.wrap {
  margin: 0 auto;
  max-width: 1240px;
  padding: 28px clamp(16px, 4vw, 36px) 46px;
}

.auth-wrap {
  align-items: center;
  background:
    linear-gradient(110deg, #111827 0%, #182235 54%, var(--bg) 54.2%, var(--bg) 100%);
  display: grid;
  gap: clamp(24px, 5vw, 72px);
  grid-template-columns: minmax(0, 1.05fr) minmax(360px, 0.55fr);
  min-height: 100vh;
  padding: clamp(28px, 5vw, 72px);
}

.auth-copy {
  color: white;
  max-width: 760px;
  padding-top: 0;
}

.auth-copy .mark {
  height: 52px;
  margin-bottom: 20px;
  width: 52px;
}

.auth-copy h1 {
  color: white;
  font-size: clamp(2.7rem, 5.8vw, 5.5rem);
  letter-spacing: 0;
  line-height: 0.97;
  margin: 0 0 22px;
  max-width: 820px;
}

.auth-copy p {
  color: #cfd8e6;
  font-size: 1.1rem;
  line-height: 1.6;
  max-width: 600px;
}

.auth-card,
.panel,
.bet-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.auth-card {
  backdrop-filter: blur(12px);
  border-color: rgba(203, 213, 225, 0.8);
  padding: 22px;
}

.tabs {
  background: #edf1ec;
  border-radius: 8px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-bottom: 18px;
  padding: 4px;
}

.tab {
  background: transparent;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  padding: 10px;
}

.tab.active {
  background: white;
  color: var(--ink);
  font-weight: 750;
}

.grid {
  display: grid;
  gap: 18px;
}

.dashboard {
  align-items: start;
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1.35fr) minmax(330px, 0.65fr);
}

.panel {
  overflow: hidden;
  padding: 0;
}

.panel h2,
.panel h3 {
  line-height: 1.15;
  margin: 0 0 14px;
}

.panel h2 {
  font-size: 1.14rem;
}

.command-center {
  display: grid;
  gap: 18px;
}

.hero-band {
  align-items: stretch;
  background: linear-gradient(135deg, #ffffff 0%, #f7fbff 52%, #fff7df 100%);
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 20px;
  grid-template-columns: minmax(0, 1fr) minmax(420px, 0.9fr);
  padding: 24px;
}

.hero-band h2 {
  font-size: clamp(1.8rem, 3vw, 3.1rem);
  letter-spacing: 0;
  line-height: 0.98;
  margin: 0 0 10px;
}

.eyebrow {
  color: var(--teal);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  margin: 0 0 8px;
  text-transform: uppercase;
}

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

.stat-card {
  background: #111827;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: white;
  display: grid;
  gap: 8px;
  min-height: 96px;
  padding: 16px;
}

.stat-card span {
  color: #b9c3d4;
  font-size: 0.8rem;
  font-weight: 800;
}

.stat-card strong {
  font-size: 1.65rem;
  line-height: 1;
}

.stat-card.hot {
  background: linear-gradient(135deg, #32191f, #b93e4e);
}

.stat-card.win {
  background: linear-gradient(135deg, #0b2d28, #00a676);
}

.friend-strip {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 2px;
}

.friend-chip {
  align-items: center;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(27, 35, 50, 0.08);
  display: flex;
  flex: 0 0 auto;
  gap: 10px;
  min-width: 172px;
  padding: 10px 12px;
}

.friend-chip.me {
  border-color: rgba(22, 199, 183, 0.55);
  box-shadow: 0 12px 34px rgba(22, 199, 183, 0.16);
}

.friend-chip strong,
.friend-chip small {
  display: block;
}

.friend-chip small {
  color: var(--muted);
  margin-top: 2px;
}

.avatar {
  align-items: center;
  background: linear-gradient(135deg, var(--blue), var(--teal));
  border: 2px solid white;
  border-radius: 50%;
  color: white;
  display: inline-grid;
  flex: 0 0 auto;
  font-size: 0.78rem;
  font-weight: 950;
  height: 38px;
  place-items: center;
  width: 38px;
}

.avatar.mini {
  font-size: 0.66rem;
  height: 28px;
  width: 28px;
}

.avatar-stack {
  display: flex;
  margin-bottom: 10px;
}

.avatar-stack .avatar + .avatar {
  margin-left: -8px;
}

.section-panel {
  border: 1px solid rgba(219, 226, 235, 0.95);
}

.section-head {
  align-items: center;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 14px;
  justify-content: space-between;
  padding: 18px 18px 14px;
}

.section-head h2 {
  margin: 0;
}

.section-body {
  padding: 18px;
}

.section-panel.is-collapsed .section-head {
  border-bottom: 0;
}

.section-panel.is-collapsed .section-body {
  display: none;
}

.collapse-btn {
  background: #eef2f7;
  border: 1px solid #d9e1ea;
  border-radius: 7px;
  color: #344054;
  font-size: 0.82rem;
  font-weight: 850;
  min-height: 34px;
  padding: 7px 11px;
}

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

.fine {
  color: var(--muted);
  font-size: 0.82rem;
}

form {
  display: grid;
  gap: 13px;
}

label {
  color: #37424a;
  display: grid;
  font-size: 0.84rem;
  font-weight: 750;
  gap: 6px;
}

input,
select,
textarea {
  background: white;
  border: 1px solid #cbd2cc;
  border-radius: 7px;
  color: var(--ink);
  min-height: 42px;
  padding: 10px 12px;
  width: 100%;
}

textarea {
  min-height: 82px;
  resize: vertical;
}

.row {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr 1fr;
}

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

.btn {
  align-items: center;
  background: #111827;
  border: 1px solid #111827;
  border-radius: 7px;
  color: white;
  display: inline-flex;
  font-weight: 800;
  gap: 8px;
  justify-content: center;
  min-height: 40px;
  padding: 9px 13px;
}

.btn:hover {
  background: #263247;
}

.btn.secondary {
  background: white;
  border-color: #bdc8c1;
  color: var(--ink);
}

.btn.danger {
  background: #fff3f4;
  border-color: #f1b4bd;
  color: var(--red);
}

.btn.ghost {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.35);
}

.status {
  border-radius: 999px;
  display: inline-flex;
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0.02em;
  padding: 5px 9px;
  text-transform: uppercase;
}

.status.open {
  background: #e8edff;
  color: var(--blue);
}

.status.resolved {
  background: #e7f5ed;
  color: var(--green-dark);
}

.status.settled {
  background: #f2f2f2;
  color: #586068;
}

.status.void {
  background: #fff0ed;
  color: var(--red);
}

.bet-card {
  border-left: 4px solid var(--teal);
  padding: 18px;
}

.bet-head {
  align-items: start;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.bet-title {
  font-size: 1.16rem;
  font-weight: 850;
  margin: 0 0 5px;
}

.meta {
  color: var(--muted);
  font-size: 0.86rem;
}

.terms {
  color: #334047;
  line-height: 1.45;
  margin: 14px 0;
  white-space: pre-wrap;
}

.side-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

.pill {
  background: #f4f7fb;
  border: 1px solid #e1e7ef;
  border-radius: 999px;
  color: #25322f;
  display: inline-flex;
  gap: 7px;
  padding: 7px 10px;
}

.amount {
  color: #057451;
  font-size: 1.35rem;
  font-weight: 900;
}

.empty {
  border: 1px dashed #bdc6c0;
  border-radius: 8px;
  color: var(--muted);
  padding: 24px;
  text-align: center;
}

.balance-row,
.settlement-row {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 4px;
  padding: 12px 0;
}

.ledger-line {
  align-items: center;
  display: flex;
  gap: 8px;
}

.balance-row:first-child,
.settlement-row:first-child {
  border-top: 0;
  padding-top: 0;
}

.balance-row strong {
  color: var(--green-dark);
}

.participants {
  display: grid;
  gap: 8px;
}

.participant {
  align-items: center;
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr) 96px auto;
}

.icon-btn {
  background: #fff7f5;
  border: 1px solid #e0beb8;
  border-radius: 7px;
  color: var(--red);
  height: 42px;
  width: 42px;
}

.toast {
  background: #13211f;
  border-radius: 8px;
  bottom: 22px;
  color: white;
  left: 50%;
  max-width: min(520px, calc(100vw - 32px));
  padding: 12px 16px;
  position: fixed;
  transform: translateX(-50%);
  z-index: 10;
}

.activity-row {
  align-items: center;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 11px;
  padding: 13px 0;
}

.activity-row:first-child {
  border-top: 0;
  padding-top: 0;
}

.activity-row strong,
.activity-row small {
  display: block;
}

.activity-row small {
  color: var(--muted);
  margin-top: 3px;
}

.activity-dot {
  background: var(--muted);
  border-radius: 999px;
  box-shadow: 0 0 0 5px #eef2f7;
  flex: 0 0 auto;
  height: 10px;
  width: 10px;
}

.activity-dot.open {
  background: var(--blue);
}

.activity-dot.resolved,
.activity-dot.paid {
  background: var(--green);
}

.activity-dot.void {
  background: var(--red);
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.filter {
  background: white;
  border: 1px solid #c9d0ca;
  border-radius: 999px;
  color: #334047;
  padding: 8px 12px;
}

.filter.active {
  background: #14211f;
  border-color: #14211f;
  color: white;
}

.hidden {
  display: none !important;
}

@media (max-width: 900px) {
  .auth-wrap,
  .hero-band,
  .dashboard {
    grid-template-columns: 1fr;
  }

  .auth-wrap {
    align-items: start;
    background:
      linear-gradient(180deg, #111827 0, #1d2637 52%, var(--bg) 52.2%, var(--bg) 100%);
  }
}

@media (max-width: 640px) {
  body {
    background: var(--bg);
  }

  .auth-wrap {
    background:
      linear-gradient(180deg, #111827 0, #1d2637 430px, var(--bg) 431px);
    gap: 18px;
    min-height: auto;
    padding: 28px 16px 36px;
  }

  .auth-copy {
    min-height: 360px;
    padding: 20px 6px 0;
  }

  .auth-copy .mark {
    height: 46px;
    margin-bottom: 18px;
    width: 46px;
  }

  .auth-copy h1 {
    font-size: clamp(2.25rem, 13vw, 3.45rem);
    line-height: 0.98;
    margin-bottom: 16px;
  }

  .auth-copy p {
    color: #dce3ee;
    font-size: 1rem;
    line-height: 1.45;
    margin: 0 0 14px;
  }

  .auth-card {
    padding: 18px;
  }

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

  .row,
  .participant {
    grid-template-columns: 1fr;
  }

  .hero-band {
    padding: 18px;
  }

  .stat-grid {
    grid-template-columns: 1fr;
  }

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

  .participant .icon-btn {
    width: 100%;
  }

  .bet-head {
    display: grid;
  }
}
