/* public/css/style.css
   Design: "Shared Ledger" — a calm paper-and-ink aesthetic for a tool whose
   whole job is keeping an honest, legible record between friends.
*/

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --cream: #FAF7F0;
  --ink: #1F2420;
  --ink-soft: #4A5249;
  --moss: #3D5A45;
  --moss-dark: #2C4233;
  --clay: #C76B47;
  --clay-soft: #F3E3DA;
  --line: #E3DDD0;
  --line-strong: #CFC7B6;
  --sage: #EDF1EB;
  --white: #FFFFFF;

  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

  --radius: 10px;
  --shadow-card: 0 1px 2px rgba(31, 36, 32, 0.04), 0 4px 16px rgba(31, 36, 32, 0.06);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  background-image:
    linear-gradient(var(--cream) 0%, var(--cream) 100%);
}

a { color: var(--moss); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap {
  max-width: 560px;
  margin: 0 auto;
  padding: 32px 20px 80px;
}

/* --- Top brand mark --- */
.brand {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 28px;
}
.brand .mark {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 20px;
  letter-spacing: -0.01em;
}
.brand .mark em {
  font-style: italic;
  color: var(--moss);
}
.brand .sub {
  font-size: 12px;
  color: var(--ink-soft);
  letter-spacing: 0.02em;
}

/* --- Headings --- */
h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 6px;
  color: var(--ink);
}
h1 { font-size: 28px; line-height: 1.15; }
h2 { font-size: 19px; }
h3 { font-size: 15px; }

p { line-height: 1.55; color: var(--ink-soft); margin: 0 0 16px; }
.lede { font-size: 15px; color: var(--ink-soft); margin-bottom: 28px; }

/* --- Card --- */
.card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 22px;
  margin-bottom: 16px;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14px;
  padding: 12px 20px;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.04s ease, opacity 0.15s ease;
  width: 100%;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--moss); color: var(--white); }
.btn-primary:hover { background: var(--moss-dark); text-decoration: none; }
.btn-secondary { background: var(--white); color: var(--ink); border-color: var(--line-strong); }
.btn-secondary:hover { background: var(--sage); text-decoration: none; }
.btn-clay { background: var(--clay); color: var(--white); }
.btn-clay:hover { opacity: 0.92; text-decoration: none; }
.btn-ghost { background: transparent; color: var(--ink-soft); border: none; padding: 8px 12px; width: auto; font-weight: 500; }
.btn-ghost:hover { color: var(--ink); text-decoration: none; }
.btn-block-row { display: flex; gap: 10px; }
.btn-sm { padding: 8px 14px; font-size: 13px; width: auto; }

/* --- Form elements --- */
label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 6px;
}
input[type="text"],
input[type="number"],
select {
  width: 100%;
  font-family: var(--font-body);
  font-size: 15px;
  padding: 11px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--cream);
  color: var(--ink);
  margin-bottom: 16px;
}
input:focus, select:focus {
  outline: 2px solid var(--moss);
  outline-offset: 1px;
  background: var(--white);
}
.field-row { display: flex; gap: 12px; }
.field-row > div { flex: 1; }

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.checkbox-row:last-child { border-bottom: none; }
.checkbox-row input { width: auto; margin: 0; }

/* --- Ledger / receipt list --- */
.ledger {
  border-top: 1px dashed var(--line-strong);
}
.ledger-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px dashed var(--line-strong);
}
.ledger-item .desc { font-weight: 500; font-size: 14.5px; }
.ledger-item .meta { font-size: 12.5px; color: var(--ink-soft); margin-top: 2px; }
.ledger-item .amt {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 17px;
  white-space: nowrap;
}
.ledger-total {
  display: flex;
  justify-content: space-between;
  padding-top: 16px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 18px;
}

/* --- Member chips / avatars --- */
.member-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.member-row:last-child { border-bottom: none; }
.avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--sage);
  color: var(--moss-dark);
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 13px;
  flex-shrink: 0;
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.member-name { font-weight: 500; font-size: 14.5px; flex: 1; }
.badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 100px;
  letter-spacing: 0.02em;
}
.badge-admin { background: var(--clay-soft); color: var(--clay); }
.badge-pending { background: var(--line); color: var(--ink-soft); }
.badge-joined { background: var(--sage); color: var(--moss-dark); }

/* --- Settlement transfer card --- */
.transfer {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 10px;
  background: var(--white);
}
.transfer.paid {
  background: var(--sage);
  border-color: #D7E3D5;
}
.transfer .who {
  flex: 1;
  font-size: 14.5px;
}
.transfer .who strong { font-weight: 600; }
.transfer .arrow { color: var(--ink-soft); font-size: 13px; padding: 0 2px; }
.transfer .amt {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 17px;
  color: var(--clay);
}
.transfer.paid .amt { color: var(--moss-dark); text-decoration: line-through; opacity: 0.7; }

/* --- Misc --- */
.divider { border: none; border-top: 1px solid var(--line); margin: 20px 0; }
.center { text-align: center; }
.muted { color: var(--ink-soft); font-size: 13px; }
.empty-state {
  text-align: center;
  padding: 40px 16px;
  color: var(--ink-soft);
}
.empty-state .glyph { font-size: 32px; margin-bottom: 10px; opacity: 0.5; }

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: 100px;
  margin-bottom: 16px;
}
.status-open { background: var(--sage); color: var(--moss-dark); }
.status-closed { background: var(--line); color: var(--ink-soft); }

.section-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  margin-bottom: 12px;
}

.copy-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--cream);
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 13px;
  word-break: break-all;
  margin-bottom: 16px;
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--white);
  padding: 10px 18px;
  border-radius: 100px;
  font-size: 13px;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}
.toast.show { opacity: 1; }

@media (max-width: 420px) {
  .field-row { flex-direction: column; gap: 0; }
  .btn-block-row { flex-direction: column; }
}
