:root {
  --primary: #0d3d38; /* Jade */
  --primary-dark: #1a5c55;
  --primary-light: #e6f2f0;
  --amber: #c9843a;
  --amber2: #e0963e;
  --amber-light: #fdf3e7;
  --bg: #f7f3ee; /* sand */
  --surface: #ffffff;
  --text: #1c1917; /* ink */
  --text-light: #57534e;
  --text-lighter: #a8a29e;
  --border: #ede8e2; /* sand2 */
  --danger: #dc2626;
  --danger-light: #fef2f2;
  --success: #16a34a;
  --r: 12px;
  --rl: 18px;
  --sh: 0 2px 8px rgba(0,0,0,.07), 0 1px 3px rgba(0,0,0,.05);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Noto Sans SC', 'Inter', sans-serif; background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; }

/* ── HELPERS ── */
.text-center { text-align: center; }
.mt-1 { margin-top: 10px; }
.mt-2 { margin-top: 20px; }
.mb-1 { margin-bottom: 10px; }

/* ── LAYOUT ── */
.view { display: none; min-height: 100vh; position: relative; padding-bottom: 100px; }
.view.active { display: block; animation: fade-in 0.3s; }
.container { max-width: 680px; margin: 0 auto; padding: 18px 14px; }

/* ── TOP NAV / HERO ── */
.topnav { position: sticky; top: 0; z-index: 900; background: rgba(13,61,56,.97); backdrop-filter: blur(16px); padding: 0 16px; height: 52px; display: flex; align-items: center; justify-content: space-between; color: #fff; }
.topnav-inner { max-width: 680px; margin: 0 auto; width: 100%; display: flex; align-items: center; justify-content: space-between; }
.back-btn { color: rgba(255,255,255,.8); font-size: 0.9rem; font-weight: 500; cursor: pointer; text-decoration: none; border: none; background: none; }
.topnav-title { font-weight: 700; font-size: 1rem; }
.lang-btn { background: rgba(255,255,255,0.15); border: none; color: #fff; padding: 4px 10px; border-radius: 8px; font-size: 0.8rem; font-weight: 600; cursor: pointer; }

.hero-strip { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); padding: 22px 16px 24px; text-align: center; }
.hero-strip h1 { color: #fff; font-size: 1.5rem; font-weight: 700; margin-bottom: 6px; }
.hero-strip p { color: rgba(255,255,255,.7); font-size: 0.85rem; }

.stat-card-wrap { max-width: 680px; margin: 14px auto 0; padding: 0 14px; }
.stat-card { background: rgba(255,255,255,.13); border: 1px solid rgba(255,255,255,.18); border-radius: var(--rl); padding: 16px; text-align: center; backdrop-filter: blur(8px); color: #fff; }
.stat-card .sv { font-size: 2rem; font-weight: 900; margin-top: 5px; }

/* ── CARDS ── */
.card { background: var(--surface); border-radius: var(--rl); box-shadow: var(--sh); border: 1px solid var(--border); margin-bottom: 16px; overflow: hidden; }
.card-hd { padding: 16px 16px 0; display: flex; align-items: center; justify-content: space-between; }
.card-title { font-size: .95rem; font-weight: 700; color: var(--text); }
.card-body { padding: 16px; }

/* ── TRIPS GRID ── */
.trip-card { background: var(--surface); border-radius: var(--rl); padding: 20px; box-shadow: var(--sh); cursor: pointer; transition: transform 0.2s; border: 1px solid var(--border); margin-bottom: 12px; }
.trip-card:active { transform: scale(0.98); }
.trip-title { font-size: 1.25rem; font-weight: 700; margin-bottom: 8px; color: var(--primary); display: flex; justify-content: space-between; }
.trip-meta { font-size: 0.85rem; color: var(--text-light); }

/* ── EXPENSE LIST ── */
.exp-item { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--border); cursor: pointer; transition: background .15s; }
.exp-item:last-child { border-bottom: none; }
.exp-item:hover { background: var(--bg); }
.exp-icon { width: 42px; height: 42px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.2rem; font-weight: 700; }
.exp-info { flex: 1; min-width: 0; }
.exp-title { font-weight: 600; font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.exp-meta { font-size: .75rem; color: var(--text-light); margin-top: 4px; }
.exp-right { text-align: right; flex-shrink: 0; }
.exp-amount { font-weight: 700; font-size: 1.1rem; color: var(--text); }

/* ── FORMS & INPUTS ── */
.form-group { margin-bottom: 14px; }
.form-label { display: block; font-size: .8rem; font-weight: 700; color: var(--text-light); margin-bottom: 6px; }
.form-input, .form-select { width: 100%; padding: 12px 14px; border: 1.5px solid var(--border); border-radius: var(--r); font-size: .95rem; color: var(--text); background: var(--surface); outline: none; transition: border-color .2s; }
.form-input:focus, .form-select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.hero-input { font-size: 1.5rem; text-align: center; border: none; border-bottom: 2px solid transparent; background: transparent; width: 100%; padding: 5px; font-weight: 700; margin-bottom: 10px; }
.hero-input:focus { border-bottom: 2px solid var(--primary); }
.amt-wrap { display: flex; align-items: center; justify-content: center; gap: 5px; font-size: 2.5rem; font-weight: 800; color: var(--primary); margin-bottom: 10px; }
.amt-input { font-size: 3rem; text-align: left; border: none; outline: none; width: 150px; background: transparent; color: var(--primary); font-weight: 900; }

/* ── BUTTONS ── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 12px 22px; border-radius: var(--r); font-size: .95rem; font-weight: 700; border: none; cursor: pointer; transition: transform .2s, box-shadow .2s; width: 100%; }
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: #fff; box-shadow: 0 4px 14px rgba(13,61,56,.3); }
.btn-amber { background: linear-gradient(135deg, var(--amber), var(--amber2)); color: #fff; box-shadow: 0 4px 14px rgba(201,132,58,.3); }
.btn-ghost { background: transparent; border: 1.5px solid var(--border); color: var(--text-light); }
.btn:active { transform: scale(0.98); }

.fab { position: fixed; bottom: 30px; right: 20px; width: 56px; height: 56px; border-radius: 28px; background: linear-gradient(135deg, var(--amber), var(--amber2)); color: #fff; font-size: 2rem; border: none; box-shadow: 0 6px 20px rgba(201,132,58,.4); display: flex; align-items: center; justify-content: center; cursor: pointer; z-index: 100; transition: transform 0.2s; }
.fab:active { transform: scale(0.9); }

/* ── SPLIT TABS ── */
.split-tabs { display: flex; gap: 6px; margin: 16px 0; }
.split-tab { flex: 1; padding: 10px 8px; border: 2px solid var(--border); border-radius: 10px; background: var(--surface); text-align: center; cursor: pointer; font-size: .8rem; font-weight: 600; color: var(--text-light); transition: all .2s; }
.split-tab.selected { border-color: var(--amber); background: var(--amber-light); color: var(--amber); }

/* ── MEMBERS CHECK LIST ── */
.member-check { display: flex; align-items: center; gap: 10px; padding: 12px; border: 2px solid var(--border); border-radius: var(--r); cursor: pointer; transition: all .2s; margin-bottom: 8px; }
.member-check.checked { border-color: var(--primary); background: var(--primary-light); }
.mc-avatar { width: 34px; height: 34px; border-radius: 17px; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: .9rem; flex-shrink: 0; }
.mc-name { flex: 1; font-weight: 600; font-size: .95rem; }
.check-icon { width: 22px; height: 22px; border: 2px solid var(--border); border-radius: 11px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.member-check.checked .check-icon { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ── EXACT / PCT INPUTS ── */
.split-val-inp { width: 90px; padding: 8px; border: 1.5px solid var(--border); border-radius: 8px; text-align: right; font-weight: 700; outline: none; }
.split-val-inp:focus { border-color: var(--primary); }

/* ── MODALS ── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 1000; display: none; align-items: flex-end; justify-content: center; backdrop-filter: blur(4px); }
.modal-overlay.open { display: flex; animation: fade-in 0.2s; }
.modal { background: var(--bg); width: 100%; max-width: 680px; border-radius: 20px 20px 0 0; box-shadow: 0 -10px 40px rgba(0,0,0,0.1); padding: 20px; max-height: 90vh; overflow-y: auto; animation: slide-up 0.3s cubic-bezier(0.16,1,0.3,1); }
.modal-handle { width: 40px; height: 5px; background: var(--border); border-radius: 3px; margin: 0 auto 15px; }
.modal-title { font-size: 1.1rem; font-weight: 700; text-align: center; margin-bottom: 20px; }

/* ── BALANCES ── */
.bal-row { display: flex; align-items: center; gap: 10px; padding: 14px; background: var(--surface); border-radius: var(--r); margin-bottom: 8px; border: 1px solid var(--border); }
.bal-net { font-size: 1.1rem; font-weight: 800; margin-left: auto; }
.bal-net.positive { color: var(--success); }
.bal-net.negative { color: var(--danger); }

/* ── LOADER & TOAST ── */
.loader-overlay { position: fixed; inset: 0; background: rgba(255,255,255,0.8); z-index: 2000; display: none; align-items: center; justify-content: center; flex-direction: column; backdrop-filter: blur(4px); }
.loader-overlay.show { display: flex; }
.spinner { width: 40px; height: 40px; border: 4px solid var(--border); border-top: 4px solid var(--primary); border-radius: 50%; animation: spin 1s linear infinite; margin-bottom: 10px; }
.toast { position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%) translateY(50px); background: var(--text); color: #fff; padding: 12px 24px; border-radius: 100px; font-weight: 600; font-size: .9rem; z-index: 3000; opacity: 0; transition: all .3s; pointer-events: none; }
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }

@keyframes spin { 100% { transform: rotate(360deg); } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes slide-up { from { transform: translateY(100%); } to { transform: translateY(0); } }

/* Responsive adjustments */
@media (min-width: 601px) {
  .modal-overlay { align-items: center; }
  .modal { border-radius: 20px; }
}
