/* SplitTab: mobile first, following the mockup (teal header, purple balance card). */

:root {
  --teal: #2C8C8C;
  --teal-dark: #23706F;
  --purple: #6C4BB5;
  --bg: #F2F3F7;
  --card: #FFFFFF;
  --ink: #1F2430;
  --muted: #7A8194;
  --line: #E4E6EE;
  --red: #D64545;
  --green: #1E9E6A;
  --radius: 16px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  padding-bottom: calc(84px + var(--safe-bottom));
}

[hidden] { display: none !important; }

/* Header */
.top {
  background: var(--teal);
  color: #fff;
  padding: 18px 18px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand { font-size: 1.6rem; font-weight: 800; letter-spacing: -0.5px; }
.brand span { opacity: 0.85; }
.me-chip {
  width: 38px; height: 38px; border-radius: 50%;
  background: rgba(255,255,255,0.22);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.85rem;
}

/* Layout */
.app { padding: 14px 14px 0; max-width: 560px; margin: 0 auto; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: 0 1px 2px rgba(20,30,50,0.05);
}
.card h1 { font-size: 1.4rem; margin: 4px 0 6px; }
.card h2 { font-size: 1rem; margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 0.82rem; }
.grow { flex: 1; min-width: 0; }
.notice { background: #EAF6F4; color: var(--teal-dark); padding: 10px 12px; border-radius: 10px; font-size: 0.9rem; }
.head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }

/* Hero (balance card) */
.hero {
  background: var(--purple);
  color: #fff;
  border-radius: var(--radius);
  padding: 18px 18px 16px;
  margin-bottom: 14px;
}
.hero-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.hero-name { font-size: 1.15rem; font-weight: 700; }
.hero-sub { font-size: 0.82rem; opacity: 0.8; margin-top: 2px; font-family: ui-monospace, Menlo, monospace; }
.hero-amt { font-size: 1.3rem; font-weight: 700; white-space: nowrap; }
.hero-status { font-size: 0.85rem; opacity: 0.9; margin-top: 8px; }

/* Tabs */
.tabs {
  display: flex; gap: 6px; background: #E9EAF1; border-radius: 12px; padding: 4px; margin-bottom: 14px;
}
.tabs button {
  flex: 1; border: 0; background: transparent; padding: 9px; border-radius: 9px;
  font: inherit; font-weight: 600; color: var(--muted); cursor: pointer;
}
.tabs button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,0.06); }

/* Rows */
.row-item {
  display: flex; align-items: center; gap: 12px; width: 100%;
  background: none; border: 0; border-bottom: 1px solid var(--line);
  padding: 12px 2px; font: inherit; color: inherit; text-align: left; cursor: pointer;
}
.row-item:last-child { border-bottom: 0; }
.row-item.static { cursor: default; }
.emoji {
  width: 42px; height: 42px; border-radius: 12px; background: #EEF6F5;
  display: flex; align-items: center; justify-content: center; font-size: 1.2rem; flex-shrink: 0;
}
.exp-meta { font-size: 0.82rem; color: var(--muted); margin-top: 2px; }
.exp-amt { text-align: right; white-space: nowrap; font-weight: 700; }
.exp-amt .sub { font-weight: 400; font-size: 0.8rem; color: var(--muted); display: block; }
.owe { color: var(--red); font-size: 0.82rem; }
.gets { color: var(--green); font-size: 0.82rem; }
.chev { color: var(--muted); font-size: 1.3rem; }

.avatar {
  width: 32px; height: 32px; border-radius: 50%; color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.78rem; flex-shrink: 0;
}

.bal-line { font-weight: 700; }
.bal-line.pos { color: var(--green); }
.bal-line.neg { color: var(--red); }

.hist { padding: 10px 2px; border-bottom: 1px solid var(--line); }
.hist:last-child { border-bottom: 0; }

/* Forms */
label { display: block; font-size: 0.8rem; color: var(--muted); margin-bottom: 12px; text-transform: uppercase; letter-spacing: 0.04em; }
label > input, label > select { margin-top: 6px; }
input, select {
  width: 100%; padding: 12px 12px; border: 1px solid var(--line); border-radius: 12px;
  font: inherit; font-size: 1rem; color: var(--ink); background: #fff;
}
input:focus, select:focus { outline: 2px solid rgba(44,140,140,0.35); border-color: var(--teal); }
.row { display: flex; gap: 10px; }
.row label:first-child { flex: 1; }
.inline { display: flex; gap: 8px; align-items: center; }
.inline input { flex: 1; }
.inline + .inline { margin-top: 10px; }
.label { font-size: 0.8rem; color: var(--muted); margin: 4px 0 8px; text-transform: uppercase; letter-spacing: 0.04em; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.chip {
  border: 1px solid var(--line); background: #fff; border-radius: 999px;
  padding: 8px 14px; font: inherit; font-size: 0.9rem; color: var(--muted); cursor: pointer;
}
.chip.on { background: #EAF6F4; border-color: var(--teal); color: var(--teal-dark); font-weight: 600; }

/* Buttons */
.btn {
  border: 0; border-radius: 12px; padding: 12px 18px; font: inherit; font-weight: 700;
  cursor: pointer; background: var(--teal); color: #fff; white-space: nowrap;
}
.btn.primary { background: var(--teal); }
.btn.ghost { background: #EEF0F6; color: var(--ink); }
.btn.danger { background: #FBEAEA; color: var(--red); }
.btn.small { padding: 7px 12px; font-size: 0.85rem; }
.btn.full { width: 100%; margin-top: 4px; }
.btn:disabled { opacity: 0.6; }
.icon {
  border: 0; background: #EEF0F6; color: var(--ink); width: 34px; height: 34px;
  border-radius: 10px; cursor: pointer; font-size: 0.95rem; flex-shrink: 0;
}
.icon.danger-t { color: var(--red); }
.actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }

.fab {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(78px + var(--safe-bottom));
  background: var(--teal); color: #fff; border: 0; border-radius: 999px;
  padding: 14px 26px; font: inherit; font-weight: 700; box-shadow: 0 8px 20px rgba(44,140,140,0.35);
  cursor: pointer; z-index: 5;
}

.empty { text-align: center; padding: 28px 12px; color: var(--muted); }
.empty .big { font-size: 2.2rem; display: block; margin-bottom: 8px; }

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

/* Bottom nav */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  background: #fff; border-top: 1px solid var(--line);
  display: flex; justify-content: space-around;
  padding: 8px 6px calc(8px + var(--safe-bottom));
}
.bottom-nav button {
  border: 0; background: none; font: inherit; font-size: 0.78rem; color: var(--muted);
  padding: 6px 10px; cursor: pointer; font-weight: 600;
}
.bottom-nav button.active { color: var(--teal); }
.bottom-nav button.active::before {
  content: ''; display: block; width: 26px; height: 3px; border-radius: 3px;
  background: var(--teal); margin: 0 auto 6px;
}

/* Sheet (modal) */
.sheet {
  position: fixed; inset: 0; background: rgba(15,20,30,0.45); z-index: 20;
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet-card {
  background: #fff; width: 100%; max-width: 560px; max-height: 92vh; overflow: auto;
  border-radius: 20px 20px 0 0; padding: 18px 18px calc(18px + var(--safe-bottom));
}
.sheet-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.sheet-head h2 { margin: 0; }

/* Toast */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(90px + var(--safe-bottom));
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 12px; z-index: 30;
  font-size: 0.9rem; max-width: 90vw; text-align: center;
}
.toast.error { background: var(--red); }

@media (min-width: 600px) {
  .bottom-nav { max-width: 560px; left: 50%; right: auto; transform: translateX(-50%); border-radius: 16px 16px 0 0; }
}
