/* ============================================================
   TripSplit — Forest Lodge Theme
   Deep greens, glacier lakes, warm earth, mountain twilight
   ============================================================ */

/* ─── Design Tokens ─── */
:root {
  /* Forest palette (deep greens) */
  --c-forest-deep:   #1a4a0a;
  --c-forest:        #2d5a16;
  --c-forest-light:  #3d7a22;
  --c-forest-fade:   #5a9a3a;

  /* Lake palette (cool blue-greens) */
  --c-lake:          #2a7a6a;
  --c-lake-light:    #4a9a8a;
  --c-lake-pale:     #d4ece8;

  /* Warm earth accents */
  --c-wood:          #c44030;
  --c-wood-light:    #d4603a;
  --c-wood-pale:     #e8956a;
  --c-bark:          #5c4a2e;
  --c-earth:         #7a6a40;

  /* Cream neutrals */
  --c-birch:         #f5f0e6;
  --c-birch-dark:    #e0d8c8;
  --c-cream:         #faf6ee;
  --c-white:         #fffdf8;

  /* Text */
  --c-text:          #2a2018;
  --c-text-light:    #5e4e3a;
  --c-text-muted:    #887868;
  --c-text-inverse:  #faf6ee;

  /* Semantic */
  --c-error:         #c44030;
  --c-error-bg:      #fdf0ee;
  --c-success:       #2d5a16;
  --c-success-bg:    #edf7ee;
  --c-warning:       #a67c1a;
  --c-warning-bg:    #fef9ec;

  /* Typography */
  --f-display: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --f-body:    'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* Sizing */
  --radius-sm: 8px;
  --radius:    12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --shadow-sm:  0 1px 4px rgba(26,74,10,.06);
  --shadow:     0 2px 10px rgba(26,74,10,.08);
  --shadow-lg:  0 8px 24px rgba(26,74,10,.12);
  --shadow-xl:  0 16px 48px rgba(26,74,10,.16);

  --header-h:  56px;
  --nav-h:     64px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* ─── Reset ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  scroll-behavior: smooth;
}

body {
  font-family: var(--f-body);
  font-weight: 400;
  color: var(--c-text);
  background:
    radial-gradient(ellipse at 50% 0%, rgba(45,90,22,.03) 0%, transparent 70%),
    var(--c-birch);
  line-height: 1.55;
  min-height: 100dvh;
  overscroll-behavior-y: contain;
  -webkit-font-smoothing: antialiased;
}

img, svg { display: block; max-width: 100%; }
a { color: var(--c-forest); text-decoration: none; }
a:hover { color: var(--c-forest-light); }
button { font: inherit; cursor: pointer; border: none; background: none; }
input, select, textarea { font: inherit; }
ul, ol { list-style: none; }

/* ─── App Shell ─── */
#app {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.app-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  color: var(--c-forest);
  gap: 16px;
  background:
    radial-gradient(ellipse at 50% 60%, rgba(45,90,22,.06) 0%, transparent 60%),
    var(--c-birch);
}

.app-loading__logo {
  animation: pulse-gentle 2s ease-in-out infinite;
}

.app-loading__text {
  font-family: var(--f-display);
  font-size: 1rem;
  color: var(--c-text-muted);
}

@keyframes pulse-gentle {
  0%, 100% { opacity: .6; transform: scale(1); }
  50%      { opacity: 1;  transform: scale(1.05); }
}

/* ─── Header ─── */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: linear-gradient(180deg, var(--c-forest-deep) 0%, var(--c-forest) 100%);
  color: var(--c-text-inverse);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
  box-shadow: 0 2px 12px rgba(26,74,10,.25);
}

.header--scenic {
  position: relative;
  height: 160px;
  background: var(--c-forest-deep);
  align-items: flex-end;
  padding-bottom: 16px;
  overflow: hidden;
}

.header__scene {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center bottom;
  pointer-events: none;
}

.header__logo {
  position: absolute;
  top: 12px;
  left: 16px;
  z-index: 2;
  color: rgba(250,246,238,.8);
}
.header__logo svg { width: 32px; height: 32px; }

.header__title--scenic {
  position: relative;
  z-index: 2;
  font-size: 1.5rem;
  text-align: center;
  width: 100%;
}

.header--scenic .header__action {
  position: absolute;
  top: 10px;
  right: 12px;
  z-index: 2;
}

.header__back {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--c-text-inverse);
  border-radius: 50%;
  transition: background .15s;
}
.header__back:hover { background: rgba(255,255,255,.1); }

.header__title {
  flex: 1;
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 1.15rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header__subtitle {
  font-size: .75rem;
  font-weight: 400;
  opacity: .7;
  display: block;
  line-height: 1.2;
}

.header__action {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--c-text-inverse);
  border-radius: 50%;
  transition: background .15s;
}
.header__action:hover { background: rgba(255,255,255,.1); }

/* ─── Bottom Navigation ─── */
.nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: calc(var(--nav-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: var(--c-white);
  border-top: none;
  display: flex;
  align-items: stretch;
  box-shadow: 0 -2px 12px rgba(26,74,10,.06);
}

.nav::before {
  content: '';
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  height: 40px;
  background: url('/img/bot.png') center bottom / cover no-repeat;
  pointer-events: none;
  opacity: .55;
}

.nav__item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--c-text-muted);
  font-size: .68rem;
  font-weight: 500;
  letter-spacing: .02em;
  transition: color .15s;
  -webkit-tap-highlight-color: transparent;
}
.nav__item svg { width: 22px; height: 22px; }
.nav__item.active { color: var(--c-forest); }
.nav__item:not(.active):hover { color: var(--c-text-light); }

/* ─── Page Container ─── */
.page {
  flex: 1;
  padding: 20px 18px calc(var(--nav-h) + var(--safe-bottom) + 56px);
  max-width: 600px;
  width: 100%;
  margin: 0 auto;
  animation: page-enter .25s ease-out;
}

.page--no-nav {
  padding-bottom: 16px;
}

.page--center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100dvh - var(--header-h));
}

@keyframes page-enter {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── Cards ─── */
.card {
  background: var(--c-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  border: 1px solid rgba(224,216,200,.4);
  overflow: hidden;
}

.card + .card { margin-top: 12px; }

.card__header {
  padding: 14px 16px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.card__title {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 1.05rem;
}

.card__body { padding: 0 16px 14px; }
.card__body--flush { padding: 0; }

/* ─── Section ─── */
.section-title {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 1.3rem;
  margin-bottom: 12px;
  color: var(--c-forest-deep);
}

.section-subtitle {
  font-size: .85rem;
  color: var(--c-text-light);
  margin-top: -8px;
  margin-bottom: 16px;
}

/* ─── List Items ─── */
.list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--c-birch);
  transition: background .12s;
  cursor: pointer;
}
.list-item:last-child { border-bottom: none; }
.list-item:active { background: var(--c-birch); }
.list-item::after {
  content: '';
  width: 7px;
  height: 7px;
  border-right: 2px solid var(--c-text-muted);
  border-bottom: 2px solid var(--c-text-muted);
  transform: rotate(-45deg);
  flex-shrink: 0;
  opacity: .35;
}
.list-item--no-chevron::after { display: none; }

.list-item__icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--c-birch);
  color: var(--c-forest);
}

.list-item__content { flex: 1; min-width: 0; }

.list-item__title {
  font-weight: 600;
  font-size: .95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.list-item__sub {
  font-size: .8rem;
  color: var(--c-text-light);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.list-item__trail {
  text-align: right;
  flex-shrink: 0;
}

.list-item__amount {
  font-weight: 700;
  font-size: .95rem;
}
.list-item__amount--positive { color: var(--c-success); }
.list-item__amount--negative { color: var(--c-error); }

.list-item__date {
  font-size: .75rem;
  color: var(--c-text-muted);
}

/* ─── Date Separator ─── */
.date-separator {
  padding: 12px 16px 6px;
  font-size: .72rem;
  font-weight: 700;
  font-family: var(--f-display);
  color: var(--c-bark);
  letter-spacing: .08em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 10px;
}
.date-separator::before {
  content: '';
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--c-forest-fade);
  flex-shrink: 0;
}
.date-separator::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--c-birch-dark), transparent);
}

/* ─── Buttons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 24px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: .95rem;
  letter-spacing: .01em;
  transition: all .15s;
  -webkit-tap-highlight-color: transparent;
}

.btn--primary {
  background: linear-gradient(180deg, var(--c-forest-light) 0%, var(--c-forest) 100%);
  color: var(--c-text-inverse);
}
.btn--primary:hover { background: linear-gradient(180deg, var(--c-forest) 0%, var(--c-forest-deep) 100%); }
.btn--primary:active { background: var(--c-forest-deep); transform: scale(.98); }

.btn--secondary {
  background: var(--c-birch);
  color: var(--c-forest);
  border: 1.5px solid var(--c-birch-dark);
}
.btn--secondary:hover { background: var(--c-birch-dark); }

.btn--danger {
  background: var(--c-error);
  color: var(--c-white);
}
.btn--danger:hover { opacity: .9; }

.btn--ghost {
  background: transparent;
  color: var(--c-forest);
}
.btn--ghost:hover { background: var(--c-birch); }

.btn--sm {
  min-height: 36px;
  padding: 0 14px;
  font-size: .85rem;
  border-radius: var(--radius-sm);
}

.btn--block { width: 100%; border-radius: var(--radius-lg); }

.btn:disabled, .btn[disabled] {
  opacity: .5;
  pointer-events: none;
}

.btn svg { width: 18px; height: 18px; }

/* ─── FAB ─── */
.fab {
  position: fixed;
  bottom: calc(var(--nav-h) + var(--safe-bottom) + 48px);
  right: 16px;
  z-index: 50;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--c-forest) 0%, var(--c-forest-deep) 100%);
  color: var(--c-white);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg), 0 0 0 3px rgba(45,90,22,.15);
  transition: transform .15s, box-shadow .15s;
}
.fab:hover { transform: scale(1.05); box-shadow: var(--shadow-xl), 0 0 0 5px rgba(45,90,22,.1); }
.fab:active { transform: scale(.95); }
.fab svg { width: 24px; height: 24px; }

/* ─── Forms ─── */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-weight: 600;
  font-size: .85rem;
  color: var(--c-text);
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  background: var(--c-white);
  border: 1.5px solid var(--c-birch-dark);
  border-radius: var(--radius);
  color: var(--c-text);
  font-size: .95rem;
  transition: border-color .15s, box-shadow .15s;
}
.form-input:focus {
  outline: none;
  border-color: var(--c-forest);
  box-shadow: 0 0 0 3px rgba(45,90,22,.12);
}
.form-input::placeholder { color: var(--c-text-muted); }
.form-input--error { border-color: var(--c-error); }

textarea.form-input {
  padding: 12px 14px;
  min-height: 100px;
  resize: vertical;
}

select.form-input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 5l3 3 3-3' stroke='%236b6b6b' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

.form-hint {
  font-size: .8rem;
  color: var(--c-text-light);
  margin-top: 4px;
}

.form-error {
  font-size: .8rem;
  color: var(--c-error);
  margin-top: 4px;
}

.form-row {
  display: flex;
  gap: 12px;
}
.form-row > * { flex: 1; }

/* ─── Toggle / Checkbox ─── */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
}

.toggle {
  position: relative;
  width: 48px;
  height: 28px;
  background: var(--c-birch-dark);
  border-radius: 14px;
  transition: background .2s;
  cursor: pointer;
}
.toggle::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  background: var(--c-white);
  border-radius: 50%;
  transition: transform .2s;
  box-shadow: var(--shadow-sm);
}
.toggle.active { background: var(--c-forest); }
.toggle.active::after { transform: translateX(20px); }

/* ─── Progress Bar ─── */
.progress {
  height: 8px;
  background: var(--c-birch);
  border-radius: 4px;
  overflow: hidden;
}

.progress__bar {
  height: 100%;
  border-radius: 4px;
  background: var(--c-forest);
  transition: width .4s ease-out;
}
.progress__bar--warning { background: var(--c-warning); }
.progress__bar--danger  { background: var(--c-error); }

/* ─── Badge ─── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .02em;
}
.badge--forest  { background: rgba(45,90,22,.12); color: var(--c-forest); }
.badge--lake    { background: rgba(42,122,106,.12); color: var(--c-lake); }
.badge--wood    { background: rgba(196,64,48,.12); color: var(--c-wood); }
.badge--error   { background: var(--c-error-bg); color: var(--c-error); }

/* ─── Chip Select (split type, currency, etc.) ─── */
.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  min-height: 36px;
  padding: 0 14px;
  border-radius: 100px;
  border: 1.5px solid var(--c-birch-dark);
  background: var(--c-white);
  font-size: .85rem;
  font-weight: 500;
  color: var(--c-text-light);
  transition: all .15s;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.chip.active, .chip:hover {
  border-color: var(--c-forest);
  background: rgba(45,90,22,.06);
  color: var(--c-forest);
}
.chip.active { font-weight: 600; }

/* ─── Tabs ─── */
.tabs {
  display: flex;
  background: var(--c-white);
  border-bottom: 1px solid var(--c-birch-dark);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }

.tab {
  flex: 1;
  min-width: max-content;
  padding: 12px 16px;
  text-align: center;
  font-size: .85rem;
  font-weight: 500;
  color: var(--c-text-muted);
  border-bottom: 2px solid transparent;
  transition: color .15s, border-color .15s;
  white-space: nowrap;
  cursor: pointer;
}
.tab:hover { color: var(--c-text); }
.tab.active {
  color: var(--c-forest);
  border-bottom-color: var(--c-forest);
  font-weight: 600;
}

/* ─── Avatar / User Icon ─── */
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--c-forest);
  color: var(--c-text-inverse);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .85rem;
  flex-shrink: 0;
}
.avatar--sm { width: 28px; height: 28px; font-size: .72rem; }
.avatar--lg { width: 48px; height: 48px; font-size: 1.1rem; }
.avatar--lake  { background: var(--c-lake); }
.avatar--earth { background: var(--c-earth); }
.avatar--bark  { background: var(--c-bark); }
.avatar--sage  { background: #6a9a5a; }
.avatar--berry { background: #8a5a6a; }

/* ─── Empty State ─── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--c-text-muted);
}
.empty-state svg {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  opacity: .35;
}
.empty-state__title {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--c-text-light);
  margin-bottom: 6px;
}
.empty-state__text {
  font-size: .88rem;
  margin-bottom: 20px;
}

/* ─── Toast ─── */
.toast-container {
  position: fixed;
  top: calc(var(--header-h) + 8px);
  left: 16px;
  right: 16px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  max-width: 480px;
  margin: 0 auto;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius);
  background: var(--c-forest-deep);
  color: var(--c-text-inverse);
  font-size: .88rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  animation: toast-in .3s ease-out;
}
.toast--error   { background: var(--c-error); }
.toast--success { background: var(--c-success); }
.toast--warning { background: #8a6d1b; }

.toast__close {
  margin-left: auto;
  color: inherit;
  opacity: .7;
}
.toast__close:hover { opacity: 1; }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(-12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.toast--exit {
  animation: toast-out .2s ease-in forwards;
}

@keyframes toast-out {
  to { opacity: 0; transform: translateY(-12px); }
}

/* ─── Modal ─── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(26,74,10,.45);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fade-in .2s ease-out;
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}

@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal {
  width: 100%;
  max-width: 480px;
  max-height: 85dvh;
  background: var(--c-white);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: modal-up .25s ease-out;
}

@keyframes modal-up {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

.modal__handle {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: var(--c-birch-dark);
  margin: 10px auto 0;
}

.modal__header {
  padding: 14px 16px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal__title {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 1.1rem;
}

.modal__body {
  padding: 0 16px 16px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.modal__footer {
  padding: 12px 16px;
  border-top: 1px solid var(--c-birch);
  display: flex;
  gap: 10px;
}
.modal__footer .btn { flex: 1; }

/* ─── Loader / Spinner ─── */
.loader {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--c-birch-dark);
  border-top-color: var(--c-forest);
  border-radius: 50%;
  animation: spin .6s linear infinite;
}
.spinner--sm { width: 18px; height: 18px; border-width: 2px; }
.spinner--inline { display: inline-block; vertical-align: middle; margin-right: 6px; }

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ─── Debt / Balance Visual ─── */
.debt-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--c-birch);
}
.debt-card:last-child { border-bottom: none; }

.debt-card__arrow {
  color: var(--c-text-muted);
  flex-shrink: 0;
}
.debt-card__arrow svg { width: 18px; height: 18px; }

.debt-card__amount {
  margin-left: auto;
  font-weight: 700;
  font-size: .95rem;
  color: var(--c-earth);
  flex-shrink: 0;
}

/* ─── Balance Bar ─── */
.balance-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--c-birch);
}
.balance-row:last-child { border-bottom: none; }

.balance-row__name {
  width: 80px;
  font-weight: 500;
  font-size: .88rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.balance-row__bar {
  flex: 1;
  height: 24px;
  position: relative;
  display: flex;
  align-items: center;
}

.balance-row__fill {
  height: 100%;
  border-radius: 4px;
  min-width: 2px;
  transition: width .4s ease-out;
}
.balance-row__fill--positive { background: var(--c-success); }
.balance-row__fill--negative { background: var(--c-error); }

.balance-row__value {
  font-size: .82rem;
  font-weight: 600;
  margin-left: 8px;
  white-space: nowrap;
}

/* ─── Split Type Selector ─── */
.split-table {
  width: 100%;
  border-collapse: collapse;
}

.split-table th {
  text-align: left;
  font-size: .75rem;
  font-weight: 600;
  color: var(--c-text-muted);
  padding: 6px 8px;
  border-bottom: 1px solid var(--c-birch-dark);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.split-table td {
  padding: 8px;
  border-bottom: 1px solid var(--c-birch);
  font-size: .9rem;
}

.split-table input {
  width: 80px;
  min-height: 36px;
  padding: 0 8px;
  border: 1.5px solid var(--c-birch-dark);
  border-radius: var(--radius-sm);
  text-align: right;
  font-size: .88rem;
}
.split-table input:focus {
  outline: none;
  border-color: var(--c-forest);
}

/* ─── Login / Auth Page ─── */
.auth-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: 32px 24px;
  background:
    linear-gradient(180deg,
      transparent 0%,
      transparent 35%,
      rgba(245,240,230,.4) 50%,
      var(--c-birch) 65%,
      var(--c-birch) 100%
    ),
    url('/img/top.png') top center / 100% auto no-repeat,
    var(--c-forest-deep);
}

.auth-page__logo {
  color: rgba(250,246,238,.85);
  margin-bottom: 8px;
}

.auth-page__title {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 1.8rem;
  color: var(--c-white);
  margin-bottom: 4px;
  text-shadow: 0 2px 8px rgba(26,74,10,.3);
}

.auth-page__subtitle {
  font-size: .9rem;
  color: rgba(248,244,236,.8);
  margin-bottom: 32px;
}

.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--c-white);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  box-shadow: var(--shadow-lg);
}

/* ─── Invite Page ─── */
.invite-box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: var(--c-birch);
  border-radius: var(--radius);
  margin-bottom: 12px;
}
.invite-box__link {
  flex: 1;
  font-size: .82rem;
  font-family: monospace;
  word-break: break-all;
  color: var(--c-text-light);
}
.invite-box__copy {
  flex-shrink: 0;
}

/* ─── Offline Banner ─── */
.offline-banner {
  position: fixed;
  top: var(--header-h);
  left: 0;
  right: 0;
  z-index: 99;
  padding: 6px 16px;
  background: var(--c-warning);
  color: var(--c-white);
  font-size: .8rem;
  font-weight: 600;
  text-align: center;
  animation: slide-down .3s ease-out;
}
@keyframes slide-down {
  from { transform: translateY(-100%); }
  to   { transform: translateY(0); }
}

/* ─── Overview / Dashboard ─── */
.overview-total__amount {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 2rem;
  color: var(--c-forest-deep);
  margin: 4px 0;
}

.overview-balance--positive {
  color: var(--c-success) !important;
  font-weight: 600;
}

.overview-balance--negative {
  color: var(--c-error) !important;
  font-weight: 600;
}

/* ─── Expense Form ─── */
.expense-amount-display {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 2.2rem;
  color: var(--c-forest-deep);
  margin-bottom: 8px;
}

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

.participant-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 4px;
  border-radius: 100px;
  background: var(--c-birch);
  font-size: .82rem;
  font-weight: 500;
}

.split-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.split-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border: 1.5px solid var(--c-birch-dark);
  border-radius: var(--radius);
  background: var(--c-white);
  font-size: .9rem;
  font-weight: 500;
  color: var(--c-text);
  text-align: left;
  transition: all .15s;
  cursor: pointer;
}

.split-option.active {
  border-color: var(--c-forest);
  background: rgba(45,90,22,.04);
}

.split-option__check {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--c-birch-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .75rem;
  color: transparent;
  transition: all .15s;
  flex-shrink: 0;
}

.split-option.active .split-option__check {
  background: var(--c-forest);
  border-color: var(--c-forest);
  color: white;
}

/* ─── Utilities ─── */
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-muted  { color: var(--c-text-muted); }
.text-sm     { font-size: .85rem; }
.text-xs     { font-size: .75rem; }
.font-bold   { font-weight: 700; }
.mt-4  { margin-top: 4px; }
.mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-4  { margin-bottom: 4px; }
.mb-8  { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.flex    { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-1 { flex: 1; }
.w-full { width: 100%; }
.hidden { display: none !important; }

/* ─── Tablet+ ─── */
@media (min-width: 768px) {
  .nav {
    position: static;
    height: auto;
    border-top: none;
    border-bottom: 1px solid var(--c-birch-dark);
    box-shadow: none;
    max-width: 600px;
    margin: 0 auto;
    padding-bottom: 0;
  }

  .nav::before {
    display: none;
  }

  .nav__item {
    flex-direction: row;
    gap: 6px;
    padding: 12px 16px;
  }

  .page {
    padding-bottom: 16px;
  }

  .fab {
    bottom: 24px;
    right: calc(50% - 300px + 16px);
  }

  .modal {
    border-radius: var(--radius-lg);
    margin: auto;
    max-height: 70dvh;
    animation: modal-scale .25s ease-out;
  }

  .modal-backdrop {
    align-items: center;
  }

  @keyframes modal-scale {
    from { opacity: 0; transform: scale(.95); }
    to   { opacity: 1; transform: scale(1); }
  }
}
