/* BountySplit · Option 3B — Card Grid + Split Pane
   Clean, modern, responsive (mobile + desktop) */

:root {
  --bg: #f1f5f9;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --blue: #4f46e5;
  --blue-hover: #4338ca;
  --blue-soft: #eef2ff;
  --green: #059669;
  --green-soft: #ecfdf5;
  --red: #e11d48;
  --red-soft: #fff1f2;
  --shadow: 0 8px 30px rgba(15, 23, 42, 0.07);
  --shadow-lg: 0 16px 40px rgba(79, 70, 229, 0.28);
  --radius: 16px;
  --radius-sm: 12px;
  --font: "Inter", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --max: 1100px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

a:hover {
  text-decoration: underline;
}

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

img {
  max-width: 100%;
}

/* Layout */
.wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 16px 48px;
}

/* Header */
.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 16px 0 8px;
  margin-bottom: 8px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text);
  text-decoration: none;
}

.brand:hover {
  text-decoration: none;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, #4f46e5, #6366f1);
  color: #fff;
  display: grid;
  place-items: center;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.35);
}

.brand small {
  display: block;
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.02em;
}

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

.chip {
  font-size: 0.8rem;
  color: var(--muted);
  background: var(--card);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 999px;
}

.currency-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25rem;
  font-weight: 700;
  color: var(--blue);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.88rem;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
  text-decoration: none;
}

.btn:hover {
  border-color: #c7d2fe;
  text-decoration: none;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

.btn-primary:hover {
  background: var(--blue-hover);
  border-color: var(--blue-hover);
  color: #fff;
}

.btn-success {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

.btn-success:hover {
  filter: brightness(0.95);
  color: #fff;
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
}

.btn-ghost:hover {
  background: #e2e8f0;
  color: var(--text);
}

.btn-sm {
  padding: 6px 10px;
  font-size: 0.78rem;
  border-radius: 10px;
}

.btn-block {
  width: 100%;
}

.btn-link {
  background: none;
  border: none;
  color: var(--blue);
  font-weight: 600;
  font-size: 0.8rem;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}

/* Typography helpers */
.pos {
  color: var(--green);
}
.neg {
  color: var(--red);
}
.muted {
  color: var(--muted);
}
.mono {
  font-family: var(--mono);
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* Flash messages */
.flash-list {
  list-style: none;
  padding: 0;
  margin: 0 0 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.flash {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.flash-success {
  background: var(--green-soft);
  border-color: #a7f3d0;
  color: #065f46;
}

.flash-error {
  background: var(--red-soft);
  border-color: #fecdd3;
  color: #9f1239;
}

/* Hero balance card */
.hero {
  background: linear-gradient(120deg, #312e81, #4f46e5 50%, #6366f1);
  color: #fff;
  border-radius: 20px;
  padding: 22px 20px;
  margin-bottom: 22px;
  box-shadow: var(--shadow-lg);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.hero .lbl {
  opacity: 0.85;
  font-size: 0.88rem;
  margin-bottom: 4px;
}

.hero .amt {
  font-family: var(--mono);
  font-size: clamp(1.25rem, 3vw, 1.75rem);
  font-weight: 600;
  line-height: 1.3;
}

.hero .sub {
  opacity: 0.8;
  font-size: 0.82rem;
  margin-top: 6px;
}

.hero .btn {
  background: rgba(255, 255, 255, 0.15);
  border-color: transparent;
  color: #fff;
}

.hero .btn:hover {
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
}

/* Card grid (dashboard) */
.card-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.group-card {
  display: block;
  background: var(--card);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  border: 1px solid transparent;
  color: inherit;
  text-decoration: none;
  transition: transform 0.2s var(--ease), box-shadow 0.2s, border-color 0.2s;
}

.group-card:hover {
  text-decoration: none;
  box-shadow: 0 12px 36px rgba(15, 23, 42, 0.1);
  transform: translateY(-2px);
  border-color: #c7d2fe;
}

.group-card h2,
.group-card h3 {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0 0 4px;
}

.group-card .meta {
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 12px;
}

.group-card .bal {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 0.92rem;
  padding: 10px 12px;
  background: #f8fafc;
  border-radius: 10px;
  line-height: 1.35;
}

.group-card .bal.pos {
  color: var(--green);
  background: var(--green-soft);
}

.group-card .bal.neg {
  color: var(--red);
  background: var(--red-soft);
}

.group-card .members {
  display: flex;
  gap: 6px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.av {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 0.65rem;
  font-weight: 700;
  display: grid;
  place-items: center;
  text-transform: uppercase;
}

.section-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 8px 0 12px;
}

.empty-state {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 40px 24px;
  text-align: center;
}

.empty-state h2 {
  margin: 0 0 8px;
  font-size: 1.2rem;
}

.empty-state p {
  color: var(--muted);
  margin: 0 0 16px;
}

/* Page header */
.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.page-head h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0;
}

.page-head .sub {
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 4px;
}

.back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-weight: 500;
  font-size: 0.9rem;
  margin-bottom: 12px;
  text-decoration: none;
}

.back:hover {
  color: var(--blue);
  text-decoration: none;
}

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

/* Split pane (crew detail) */
.detail-shell {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  overflow: hidden;
}

.detail-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.detail-head h1 {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0;
}

.split {
  display: grid;
  grid-template-columns: 1fr;
}

.pane-h {
  padding: 10px 16px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
}

.pane + .pane {
  border-top: 1px solid var(--border);
}

.exp-item {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: start;
}

.exp-item:last-child {
  border-bottom: none;
}

.exp-item h4 {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0;
}

.exp-item .meta {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 3px;
  line-height: 1.4;
}

.exp-item .amt {
  font-family: var(--mono);
  font-weight: 600;
  white-space: nowrap;
}

.exp-item .share {
  font-size: 0.72rem;
  margin-top: 2px;
  text-align: right;
}

.bal-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
  flex-wrap: wrap;
}

.bal-item:last-child {
  border-bottom: none;
}

.bal-item .amt {
  font-family: var(--mono);
  font-weight: 600;
}

/* Add member / secondary cards */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  overflow: hidden;
  margin-top: 16px;
}

.card-pad {
  padding: 16px 18px;
}

.card-head {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 0.95rem;
}

.inline-form {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.inline-form input {
  flex: 1;
  min-width: 140px;
}

.roster {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  list-style: none;
  padding: 0;
  margin: 0 0 12px;
}

.roster li {
  padding: 4px 10px;
  background: var(--blue-soft);
  color: var(--blue);
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
}

/* Forms */
.stack-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.stack-form label,
.field label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
}

.field {
  margin-bottom: 12px;
}

input[type="text"],
input[type="password"],
input[type="number"],
select,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.95rem;
  font-family: inherit;
  background: #f8fafc;
  color: var(--text);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
  background: #fff;
}

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

@media (max-width: 520px) {
  .form-row {
    grid-template-columns: 1fr;
  }
}

.checkbox-row {
  flex-direction: row !important;
  align-items: center;
  gap: 8px !important;
  font-size: 0.9rem !important;
  font-weight: 500 !important;
  color: var(--text) !important;
  cursor: pointer;
}

.checkbox-row input {
  width: auto;
  accent-color: var(--blue);
}

.split-field {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin: 0;
}

.split-field legend {
  padding: 0 6px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
}

.split-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
}

.split-member {
  display: grid !important;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #f8fafc;
}

.share-input {
  width: 5.5rem !important;
  max-width: 5.5rem;
  font-family: var(--mono);
}

.share-input:disabled {
  opacity: 0.35;
}

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

.checks label {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
  padding: 8px 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #f8fafc;
  cursor: pointer;
}

.checks input {
  width: auto;
  accent-color: var(--blue);
}

/* Modal */
.modal-bg {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 50;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  transition: opacity 0.2s;
}

.modal-bg.open {
  display: flex;
  opacity: 1;
}

.modal {
  width: min(440px, 100%);
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.2);
  max-height: 90vh;
  overflow-y: auto;
  animation: pop 0.25s var(--ease);
}

@keyframes pop {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.modal-h {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}

.modal-h h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
}

.modal-b {
  padding: 16px 18px;
}

.modal-f {
  padding: 12px 18px 18px;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* Auth */
.auth-wrap {
  max-width: 420px;
  margin: 24px auto;
}

.auth-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 24px;
  border: 1px solid var(--border);
}

.auth-card h1 {
  margin: 0 0 6px;
  font-size: 1.4rem;
}

.auth-switch {
  margin-top: 16px;
  font-size: 0.9rem;
  color: var(--muted);
  text-align: center;
}

/* Landing */
.landing {
  max-width: 640px;
  margin: 24px auto;
  text-align: center;
}

.landing .hero {
  text-align: left;
  margin-bottom: 24px;
}

.landing h1 {
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  margin: 0 0 12px;
}

.landing .lede {
  color: var(--muted);
  font-size: 1.05rem;
  margin: 0 0 20px;
}

.feature-strip {
  list-style: none;
  padding: 0;
  margin: 24px 0 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  text-align: left;
}

.feature-strip li {
  background: var(--card);
  border-radius: var(--radius-sm);
  padding: 14px;
  box-shadow: var(--shadow);
  font-size: 0.9rem;
  color: var(--muted);
}

.feature-strip strong {
  display: block;
  color: var(--text);
  margin-bottom: 4px;
}

/* Footer */
.site-footer {
  margin-top: 40px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
}

/* Desktop enhancements */
@media (min-width: 768px) {
  .card-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }

  .group-card:hover {
    transform: translateY(-3px);
  }

  .split {
    grid-template-columns: 1.35fr 1fr;
  }

  .pane + .pane {
    border-top: none;
    border-left: 1px solid var(--border);
  }
}

@media (min-width: 1024px) {
  .card-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
