/* ============================================================
   KnotX — Bonds Beyond Money · modern theme (EN/AR, RTL-ready)
   ============================================================ */
:root {
  --bg1: #eef4ff; --bg2: #fdf2f8; --bg3: #e6f9f3;
  --card: #ffffff;
  --ink: #1c2434; --muted: #6b7a93; --line: #e9eef6;
  --teal: #0d9488; --teal-d: #0f766e;
  --coral: #f05c7a; --coral-d: #d64563;
  --gold: #f59e0b;
  --green: #16a34a; --red: #dc2626;
  --grad: linear-gradient(135deg, #0d9488, #2563eb);
  --grad-coral: linear-gradient(135deg, #f05c7a, #f59e0b);
  --shadow: 0 8px 28px rgba(30, 45, 90, .10);
  --shadow-sm: 0 2px 10px rgba(30, 45, 90, .06);
  --r: 18px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { font-size: 16px; }
body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Tahoma, Arial, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1000px 500px at 110% -10%, rgba(37, 99, 235, .10), transparent 60%),
    radial-gradient(800px 420px at -10% 10%, rgba(240, 92, 122, .10), transparent 60%),
    radial-gradient(700px 500px at 50% 120%, rgba(13, 148, 136, .10), transparent 60%),
    linear-gradient(160deg, var(--bg1) 0%, var(--bg3) 100%);
  background-attachment: fixed;
  min-height: 100vh;
}
html[lang="ar"] body, html[dir="rtl"] body {
  font-family: "Segoe UI", Tahoma, "Noto Naskh Arabic", "Geeza Pro", sans-serif;
}
.hidden { display: none !important; }
.view { display: none; }
.view.active { display: block; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }

.app { max-width: 480px; margin: 0 auto; min-height: 100vh; padding: 0 0 90px; position: relative; }

/* ---------------- top bar ---------------- */
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 18px 16px 6px;
}
.topbar .logo { font-size: 20px; font-weight: 800; letter-spacing: -.3px; }
.topbar .tagline { font-size: 11.5px; color: var(--muted); margin-top: -1px; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.bell { position: relative; background: var(--card); border: 1px solid var(--line); border-radius: 50%; width: 38px; height: 38px; font-size: 17px; box-shadow: var(--shadow-sm); }
.badge {
  position: absolute; top: -4px; right: -4px; background: var(--coral); color: #fff;
  font-size: 10px; font-weight: 800; min-width: 17px; height: 17px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center; padding: 0 4px;
}
[dir="rtl"] .badge { right: auto; left: -4px; }
.me-wrap { position: relative; }
.me-chip {
  background: var(--card); border: 1px solid var(--line); border-radius: 30px;
  padding: 3px 10px 3px 3px; display: flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 700; box-shadow: var(--shadow-sm);
  cursor: pointer; color: inherit;
}
.me-chip .caret { font-size: 9px; opacity: .55; margin-left: -2px; }
[dir="rtl"] .me-chip .caret { margin-left: 0; margin-right: -2px; }
.me-menu {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 260;
  min-width: 168px; background: var(--card); border: 1px solid var(--line);
  border-radius: 16px; padding: 6px; box-shadow: 0 18px 45px rgba(15, 30, 60, .18);
  animation: pop .16s ease;
}
[dir="rtl"] .me-menu { right: auto; left: 0; }
.me-menu-item {
  display: flex; align-items: center; gap: 8px; width: 100%;
  background: none; border: 0; padding: 11px 12px; border-radius: 11px;
  font-size: 13.5px; font-weight: 700; color: var(--ink); cursor: pointer; text-align: start;
}
.me-menu-item:hover { background: var(--bg, #f0f4f8); }
:root[data-theme="dark"] .me-menu-item:hover { background: #1c2947; }
[dir="rtl"] .me-chip { padding: 3px 3px 3px 10px; }
.me-chip .avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--grad); display: inline-flex; align-items: center; justify-content: center; font-size: 15px; }
.avatar { font-size: 20px; }

/* ---------------- language toggle ---------------- */
.lang-row { display: flex; gap: 6px; }
.lang-row.mini { gap: 4px; }
.lang-toggle {
  background: rgba(255, 255, 255, .65); border: 1px solid var(--line); color: var(--muted);
  border-radius: 20px; padding: 4px 12px; font-size: 11.5px; font-weight: 800; backdrop-filter: blur(4px);
  transition: all .18s ease;
}
.lang-toggle.active, .lang-toggle:hover { background: var(--grad); color: #fff; border-color: transparent; box-shadow: 0 4px 12px rgba(37, 99, 235, .35); }
.lang-row.mini .lang-toggle { padding: 3px 8px; font-size: 10.5px; }

/* ---------------- buttons ---------------- */
.btn {
  border: none; border-radius: 14px; padding: 12px 18px; font-size: 14.5px; font-weight: 800;
  transition: transform .12s ease, box-shadow .18s ease, background .18s ease;
}
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--grad); color: #fff; box-shadow: 0 6px 18px rgba(37, 99, 235, .35); }
.btn.primary:hover { box-shadow: 0 8px 24px rgba(37, 99, 235, .45); }
.btn.ghost { background: #f1f4fa; color: var(--ink); }
.btn.big { width: 100%; padding: 14px; font-size: 15.5px; border-radius: 16px; }
.btn-small { border: none; border-radius: 12px; padding: 9px 14px; font-size: 13px; font-weight: 800; background: #f1f4fa; color: var(--ink); }
.btn-small.add { background: var(--grad); color: #fff; box-shadow: 0 4px 14px rgba(37, 99, 235, .3); }
.btn-sm { border: none; border-radius: 12px; padding: 8px 12px; font-size: 12.5px; font-weight: 800; background: #eaf6f4; color: var(--teal-d); }
.btn-sm.gold { background: #fef3e2; color: #b45309; }

/* ---------------- section titles & hints ---------------- */
.section-title { font-size: 13px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; margin: 22px 16px 8px; }
.hint { font-size: 12.5px; color: var(--muted); padding: 8px 16px; }
.banner {
  background: linear-gradient(135deg, rgba(13, 148, 136, .10), rgba(37, 99, 235, .10));
  border: 1px solid rgba(13, 148, 136, .18); border-radius: 14px; margin: 12px 16px;
  padding: 11px 14px; font-size: 12.5px; color: #3d5568;
}
.empty { text-align: center; color: var(--muted); font-size: 13.5px; padding: 26px 16px; line-height: 1.6; }
.empty span { font-size: 30px; display: block; margin-bottom: 8px; }

/* rich empty states + onboarding + suggested settlements */
.empty.rich { padding: 34px 20px 30px; }
.empty.rich .empty-emoji { font-size: 44px; display: block; margin-bottom: 10px; }
.empty.rich .empty-title { font-size: 16px; font-weight: 800; color: var(--ink); margin-bottom: 6px; }
.empty.rich .empty-sub { font-size: 13px; color: var(--muted); margin-bottom: 16px; max-width: 300px; margin-left: auto; margin-right: auto; }
.empty.rich .btn { margin-top: 2px; }

.welcome-card {
  margin: 12px 16px 0;
  background: linear-gradient(135deg, rgba(13, 148, 136, .12), rgba(37, 99, 235, .10));
  border: 1.5px solid rgba(13, 148, 136, .28);
  border-radius: 20px;
  padding: 22px 18px;
  text-align: center;
}
.welcome-card .welcome-emoji { font-size: 40px; display: block; margin-bottom: 6px; }
.welcome-card .welcome-title { font-size: 17px; font-weight: 800; color: var(--ink); }
.welcome-card .welcome-sub { font-size: 13px; color: #3d5568; margin: 6px auto 16px; max-width: 320px; line-height: 1.6; }
.welcome-steps { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.welcome-steps .btn-sm { padding: 9px 13px; font-size: 13px; }

.sugg-card { margin: 12px 16px 0; padding: 14px 14px 6px; }
.sugg-head { font-size: 15px; font-weight: 800; margin-bottom: 2px; }
.sugg-sub { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.sugg-row { border: none; box-shadow: none; border-top: 1px solid var(--line); border-radius: 0; padding: 11px 2px; cursor: default; }
.sugg-row:hover { transform: none; box-shadow: none; }
.sugg-row .list-avatar { width: 38px; height: 38px; border-radius: 11px; font-size: 20px; }
.sugg-row .btn-sm { margin-top: 4px; }

/* ---------------- cards / lists ---------------- */
.card-list { display: flex; flex-direction: column; gap: 10px; padding: 4px 16px; }
.card, .list-row {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: var(--shadow-sm); transition: transform .15s ease, box-shadow .2s ease;
}
.card { padding: 14px; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 13px 14px; cursor: pointer; }
.list-row:hover, .card:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.list-avatar { font-size: 24px; width: 42px; height: 42px; background: linear-gradient(135deg, #f0f4ff, #fdf0f5); border-radius: 13px; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.list-main { flex: 1; min-width: 0; }
.list-title { font-size: 14.5px; font-weight: 700; }
.list-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.list-right { text-align: left; flex: none; }
[dir="rtl"] .list-right { text-align: right; }
.list-amount { font-size: 13.5px; font-weight: 800; white-space: nowrap; }
.list-amount.owed { color: var(--green); }
.list-amount.owe { color: var(--red); }
.list-date { font-size: 11px; color: var(--muted); margin-top: 3px; }
.green { color: var(--green) !important; }
.red { color: var(--red) !important; }

/* ---------------- summary grid ---------------- */
.summary-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 10px 16px; }
.summary-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  padding: 14px; box-shadow: var(--shadow-sm);
}
.summary-card.full { grid-column: 1 / -1; background: var(--grad); color: #fff; border: none; }
.summary-card .label { font-size: 11.5px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.summary-card.full .label { color: rgba(255, 255, 255, .8); }
.summary-card .value { font-size: 22px; font-weight: 900; margin-top: 3px; letter-spacing: -.5px; }
.summary-card.full .value { font-size: 30px; }
.summary-card.full .value.green, .summary-card.full .value.red { color: #fff !important; }

/* ---------------- quick actions ---------------- */
.quick-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 12px 16px; }
.qa {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 13px 6px;
  display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 800;
  color: var(--ink); box-shadow: var(--shadow-sm); transition: transform .15s ease, box-shadow .2s ease;
}
.qa span { font-size: 22px; }
.qa:hover { transform: translateY(-2px); box-shadow: var(--shadow); }

/* ---------------- hero infographic ---------------- */
.hero-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 10px 16px 0; }
.hero-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  padding: 16px; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; justify-content: center;
}
.hero-big { font-size: 30px; font-weight: 900; letter-spacing: -1px; display: flex; align-items: baseline; gap: 6px; }
.hero-big small { font-size: 12px; font-weight: 800; color: var(--muted); }
.hero-sub { display: flex; flex-wrap: wrap; gap: 5px; font-size: 11.5px; font-weight: 700; color: var(--muted); margin-top: 5px; }
.hero-sub .dot { opacity: .4; }
.hero-chip { margin-top: 10px; font-size: 11.5px; color: var(--muted); display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.hero-chip b { color: var(--ink); font-size: 14px; }
.donut-card { align-items: center; }
.donut-wrap { position: relative; width: 92px; height: 92px; margin: 4px auto 8px; }
.hero-donut { width: 92px; height: 92px; border-radius: 50%; }
.hero-donut-center {
  position: absolute; inset: 16px; border-radius: 50%; background: var(--card);
  display: flex; align-items: center; justify-content: center; font-size: 24px;
}
.dl-legend { display: flex; flex-wrap: wrap; gap: 4px 10px; justify-content: center; font-size: 10px; color: var(--muted); }
.dl-item { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; }
.dl-item i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

/* ---------------- bond card ---------------- */
.bond-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); margin: 10px 16px 0; padding: 12px 14px; box-shadow: var(--shadow-sm); }
.bond-head { font-size: 12px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .8px; margin-bottom: 6px; }
.bond-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.bond-row:last-child { border-bottom: 0; }
.bond-mid { flex: 1; min-width: 0; }
.bond-mid b { font-size: 13.5px; }
.bond-mid small { display: block; font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bond-right { display: flex; align-items: center; gap: 6px; flex: none; }
.bond-right b { font-size: 17px; }
.tier-chip { font-size: 10px; font-weight: 800; border-radius: 20px; padding: 3px 8px; white-space: nowrap; }
.tier-chip.t0 { background: #f1f4fa; color: #6b7a93; }
.tier-chip.t1 { background: #eaf6f4; color: #0f766e; }
.tier-chip.t2 { background: #fef9e7; color: #b45309; }
.tier-chip.t3 { background: #fce7f3; color: #be185d; }
.tier-chip.t4 { background: linear-gradient(135deg, #fce7f3, #fef3c7); color: #be185d; }

/* ---------------- chips / filters ---------------- */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 8px 16px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips button { flex: none; background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 7px 14px; font-size: 12px; font-weight: 800; color: var(--muted); }
.chips button.active { background: var(--grad); color: #fff; border-color: transparent; }

/* ---------------- check grid ---------------- */
.check-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 6px 0 10px; }
.check-item {
  display: flex; align-items: center; gap: 8px; background: #f6f8fc; border: 1.5px solid var(--line);
  border-radius: 12px; padding: 9px 10px; font-size: 13px; font-weight: 700; cursor: pointer;
}
.check-item.checked { background: #eaf6f4; border-color: var(--teal); color: var(--teal-d); }
.check-item input { display: none; }
.check-line { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; margin: 10px 0; }

/* ---------------- bottom nav ---------------- */
.bottom-nav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px; background: rgba(255, 255, 255, .88);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  display: flex; justify-content: space-around; align-items: flex-start;
  border-top: 1px solid var(--line); padding: 6px 2px calc(6px + env(safe-area-inset-bottom));
  z-index: 50;
}
.nav-btn {
  background: none; border: none; display: flex; flex-direction: column; align-items: center;
  font-size: 10px; font-weight: 800; color: var(--muted); cursor: pointer; font-family: inherit;
  padding: 4px 5px; border-radius: 10px; flex: 1; min-width: 0;
}
.nav-btn span { font-size: 19px; line-height: 1.2; }
.nav-btn .nav-label { font-size: 9.5px; font-weight: 800; margin-top: 1px; }
.nav-btn.active { color: var(--teal); }
.nav-btn.fab {
  width: 52px; height: 52px; border-radius: 50%; background: var(--grad-coral); color: #fff;
  font-size: 26px; justify-content: center; margin-top: -24px; flex: none;
  box-shadow: 0 8px 20px rgba(240, 92, 122, .5); border: 3px solid #fff;
}

/* ---------------- action sheet ---------------- */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 90; display: flex; align-items: flex-end; justify-content: center; }
.sheet {
  width: 100%; max-width: 480px; background: var(--card); border-radius: 24px 24px 0 0;
  padding: 20px 16px 28px; animation: slideUp .25s ease;
}
@keyframes slideUp { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet h3 { margin: 2px 4px 12px; font-size: 15px; color: var(--muted); text-transform: uppercase; letter-spacing: .8px; }
.sheet-opt {
  display: grid; grid-template-columns: 44px 1fr; grid-template-rows: auto auto; column-gap: 12px; align-items: center;
  width: 100%; background: none; border: none; border-radius: 14px; padding: 11px 12px; text-align: start; transition: background .15s;
}
.sheet-opt:hover { background: #f4f7fc; }
.sheet-opt span { font-size: 26px; grid-row: 1 / 3; text-align: center; }
.sheet-opt b { font-size: 14.5px; color: var(--ink); }
.sheet-opt small { font-size: 12px; color: var(--muted); }

/* ---------------- modals ---------------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(15, 23, 42, .5); z-index: 95; display: flex; align-items: center; justify-content: center; padding: 18px; }
.modal {
  width: 100%; max-width: 420px; max-height: 88vh; overflow-y: auto; background: var(--card);
  border-radius: 22px; padding: 22px 20px; box-shadow: 0 24px 60px rgba(15, 23, 42, .3); animation: pop .2s ease;
}
@keyframes pop { from { transform: scale(.96); opacity: 0; } to { transform: none; opacity: 1; } }
.modal h3 { margin: 0 0 12px; font-size: 18px; }
.modal label { display: block; font-size: 12px; font-weight: 800; color: var(--muted); margin: 12px 0 4px; }
.modal input, .modal select, .modal textarea {
  width: 100%; border: 1.5px solid var(--line); border-radius: 12px; padding: 10px 12px;
  font-size: 14px; background: #fafbfe; outline: none; transition: border .15s;
}
.modal input:focus, .modal select:focus, .modal textarea:focus { border-color: var(--teal); background: #fff; }
.modal-hint { font-size: 12.5px; color: var(--muted); background: #f6f8fc; border-radius: 10px; padding: 10px 12px; margin: 0 0 8px; line-height: 1.5; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }
.modal-actions .btn { flex: 1; }
.progress { background: #eef1f6; border-radius: 10px; height: 10px; overflow: hidden; margin: 10px 0; }
.progress .warn { height: 100%; border-radius: 10px; background: linear-gradient(90deg, #34d399, #10b981); transition: width .5s ease; }
.loan-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 10px 16px; }

/* ---------------- toast ---------------- */
.toast {
  position: fixed; bottom: 96px; left: 50%; transform: translateX(-50%);
  background: #1c2434; color: #fff; padding: 12px 20px; border-radius: 30px;
  font-size: 13.5px; font-weight: 700; z-index: 120; box-shadow: 0 12px 30px rgba(0, 0, 0, .3);
  max-width: 86vw; text-align: center; animation: pop .2s ease;
}

/* ---------------- login ---------------- */
.login-view {
  position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center;
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  background:
    radial-gradient(700px 400px at 85% 0%, rgba(240, 92, 122, .18), transparent 60%),
    radial-gradient(700px 400px at 0% 100%, rgba(37, 99, 235, .16), transparent 60%),
    linear-gradient(160deg, #eef4ff, #fdf2f8);
  padding: 20px;
}
.login-card {
  width: 100%; max-width: 380px; margin: auto; background: rgba(255, 255, 255, .92); backdrop-filter: blur(10px);
  border-radius: 26px; padding: 28px 24px; box-shadow: 0 24px 70px rgba(30, 45, 90, .18);
  text-align: center; border: 1px solid rgba(255, 255, 255, .8);
}
.login-logo { font-size: 52px; line-height: 1; }
.login-card h1 { margin: 6px 0 0; font-size: 30px; letter-spacing: -1px; line-height: 1; }
.login-tag { font-size: 14px; color: var(--teal-d); font-weight: 800; margin: 2px 0 10px; }
.login-sub { font-size: 13px; color: var(--muted); line-height: 1.5; margin: 0 0 6px; }
.login-card label { display: block; text-align: start; font-size: 12px; font-weight: 800; color: var(--muted); margin: 14px 0 4px; }
.login-card input {
  width: 100%; border: 1.5px solid var(--line); border-radius: 13px; padding: 12px 14px;
  font-size: 15px; background: #fafbfe; outline: none; transition: border .15s; text-align: start;
}
.login-card input:focus { border-color: var(--teal); background: #fff; }
.login-card .btn { margin-top: 16px; }
.login-note { font-size: 11.5px; color: var(--muted); margin-top: 12px; line-height: 1.5; }
.login-view .lang-row { justify-content: center; margin-bottom: 6px; }

/* ---------------- public help page ---------------- */
.pub-wrap .lang-row { justify-content: center; }

/* ---------------- RTL fine-tuning ---------------- */
[dir="rtl"] .hero-big, [dir="rtl"] .summary-card .value, [dir="rtl"] .list-amount,
[dir="rtl"] .bond-right b { direction: ltr; unicode-bidi: embed; }
[dir="rtl"] .modal-actions { justify-content: flex-start; }
[dir="rtl"] .hero-sub, [dir="rtl"] .dl-legend, [dir="rtl"] .bond-head { text-align: right; }

/* ---------------- groups / pots / occasions / memories / swaps ---------------- */
.chip-type { font-size: 10px; font-weight: 800; color: var(--teal-d); background: #eaf6f4; border-radius: 20px; padding: 2px 8px; vertical-align: middle; }
.member-avatars { display: flex; gap: 2px; margin-top: 6px; }
.avatar.sm { width: 24px; height: 24px; border-radius: 50%; background: #eef3fa; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; }
.pot-card { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 14px 16px; margin: 10px 16px; box-shadow: 0 6px 18px rgba(15, 30, 60, .05); }
.pot-head { display: flex; align-items: center; gap: 10px; }
.pot-emoji { font-size: 26px; }
.pot-info { flex: 1; min-width: 0; }
.pot-info b { display: block; font-size: 14.5px; }
.pot-info small { color: var(--muted); font-size: 11.5px; }
.pot-meta { font-size: 12px; color: var(--muted); font-weight: 700; }
.pot-contribs { margin-top: 8px; border-top: 1px dashed var(--line); padding-top: 8px; }
.entry-row { padding: 6px 0; border-bottom: 1px dashed var(--line); }
.entry-row:last-child { border-bottom: none; }
.entry-main { font-size: 12.5px; font-weight: 700; }
.entry-sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.muted { opacity: .8; }
.bal-chip { flex: none; font-size: 11px; font-weight: 800; border-radius: 20px; padding: 5px 10px; white-space: nowrap; }
.bal-chip.green { color: var(--teal-d); background: rgba(13, 148, 136, .12); }
.bal-chip.red { color: var(--coral-d); background: rgba(240, 92, 122, .12); }
.card-actions { margin-top: 10px; display: flex; gap: 8px; }
.progress-fill { height: 100%; border-radius: 10px; background: linear-gradient(90deg, #f59e0b, #f97316); transition: width .5s ease; }
.occ-card { display: flex; align-items: center; gap: 10px; background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 10px 14px; margin: 8px 16px; }
.occ-emoji { font-size: 24px; }
.occ-info { flex: 1; min-width: 0; }
.occ-info b { display: block; font-size: 13.5px; }
.occ-info small { color: var(--muted); font-size: 11.5px; }
.occ-chip { margin-top: 8px; font-size: 12px; color: #b45309; background: #fef3e2; border-radius: 20px; padding: 4px 10px; display: inline-block; }
.person-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 12px; }
.mem-chip { margin-top: 6px; font-size: 11.5px; color: #7c3aed; background: #f5f0ff; border-radius: 20px; padding: 4px 10px; display: inline-block; }
.mem-row { background: #fff; border: 1px solid var(--line); border-radius: 16px; margin: 8px 16px; }
.notif-actions { display: flex; gap: 8px; margin-top: 8px; }

/* 9-tab nav: tighter so Groups + Pots fit */
.nav-btn .nav-label { font-size: 9px !important; }
.nav-btn { padding: 8px 0 6px; }

/* ---------------- dark mode ---------------- */
:root[data-theme="dark"] {
  --bg1: #0d1526; --bg2: #1b1030; --bg3: #0a1f1c;
  --card: #16203a; --card2: #1c2947;
  --ink: #e8eefc; --muted: #93a3c4; --line: #27344f;
  --teal: #2dd4bf; --teal-d: #5eead4;
  --coral: #fb7185; --coral-d: #fda4af;
  --gold: #fbbf24;
  --green: #4ade80; --red: #f87171;
  --grad: linear-gradient(135deg, #0d9488, #3b82f6);
  --grad-coral: linear-gradient(135deg, #f05c7a, #f59e0b);
  --shadow: 0 8px 28px rgba(0, 0, 0, .45);
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, .35);
}
:root[data-theme="dark"] body {
  background:
    radial-gradient(1000px 500px at 110% -10%, rgba(59, 130, 246, .12), transparent 60%),
    radial-gradient(800px 420px at -10% 10%, rgba(240, 92, 122, .10), transparent 60%),
    radial-gradient(700px 500px at 50% 120%, rgba(13, 148, 136, .10), transparent 60%),
    linear-gradient(160deg, #0d1526 0%, #0a1f1c 100%);
}
:root[data-theme="dark"] .bell,
:root[data-theme="dark"] .me-chip,
:root[data-theme="dark"] .list-row,
:root[data-theme="dark"] .modal,
:root[data-theme="dark"] .sheet,
:root[data-theme="dark"] .card,
:root[data-theme="dark"] .pot-card,
:root[data-theme="dark"] .occ-card,
:root[data-theme="dark"] .mem-row { background: var(--card2); }
:root[data-theme="dark"] input, :root[data-theme="dark"] select, :root[data-theme="dark"] textarea {
  background: #101a30; color: var(--ink); border-color: #2b3a58;
}
:root[data-theme="dark"] .btn.ghost, :root[data-theme="dark"] .btn-sm.ghost { background: #1c2947; color: var(--ink); }

/* ---------------- receipts ---------------- */
.cat-row { display: flex; gap: 8px; align-items: center; }
.cat-row select { flex: 1; }
.receipt-preview { display: block; max-width: 120px; max-height: 120px; border-radius: 12px; margin-top: 6px; border: 1px solid var(--line); }
.receipt-thumb { width: 34px; height: 34px; object-fit: cover; border-radius: 9px; margin-top: 5px; border: 1px solid var(--line); cursor: zoom-in; vertical-align: top; }
.receipt-modal img { max-width: 92vw; max-height: 70vh; border-radius: 14px; display: block; margin: 0 auto; }
.rec-badge { font-size: 10px; font-weight: 800; color: var(--teal-d); background: rgba(13, 148, 136, .12); border-radius: 20px; padding: 2px 8px; vertical-align: middle; margin-left: 4px; }
[dir="rtl"] .rec-badge { margin-left: 0; margin-right: 4px; }

/* ---------------- share row (payment request) ---------------- */
.share-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
.share-label { font-size: 11px; color: var(--muted); margin-right: auto; }
.btn-sm { font-size: 12px; padding: 7px 12px; border-radius: 20px; border: 1px solid var(--line); background: var(--card); box-shadow: var(--shadow-sm); }

/* ---------------- referral card ---------------- */
.referral { background: linear-gradient(135deg, #eef7ff, #f3fdf8); border: 1.5px solid #b9e4d8; margin: 12px 16px 0; }
.referral .coupon-title { font-size: 15px; }
.referral .coupon-msg { margin: 4px 0 8px; }
.referral-code {
  display: inline-block; font-family: ui-monospace, Consolas, monospace; font-size: 15px; font-weight: 800;
  letter-spacing: 2px; color: var(--teal-d); background: #fff; border: 1.5px dashed var(--teal);
  border-radius: 10px; padding: 7px 14px; margin: 2px 0 4px;
}
[dir="rtl"] .referral-code { letter-spacing: 1px; }

/* ---------------- deal wall ---------------- */
.deal { border: 1.5px solid #fde4a8; background: linear-gradient(135deg, #fffdf5, #fff8ea); }
.deal-site { display: inline-block; font-size: 11px; font-weight: 800; color: #92400e; background: #fef3c7; border-radius: 20px; padding: 2px 8px; margin-right: 4px; vertical-align: 1px; }
.deal-savings { font-size: 13px; font-weight: 800; color: var(--teal-d); margin: 4px 0 2px; }
.deal-code { display: inline-block; font-family: ui-monospace, Consolas, monospace; font-size: 13px; font-weight: 800; letter-spacing: 1.5px; color: var(--teal-d); background: #fff; border: 1.5px dashed var(--teal); border-radius: 8px; padding: 5px 10px; margin: 4px 0 2px; cursor: pointer; }
.deal-code small { font-family: inherit; font-size: 10px; font-weight: 700; letter-spacing: 0; color: var(--muted); }
.btn-sm.primary-sm { background: var(--grad); color: #fff; border-color: transparent; }

/* ---------------- wishlist ---------------- */
.wish { border: 1.5px solid #d8c9fd; background: linear-gradient(135deg, #faf7ff, #f3eefe); }
.wish.wish-inrange { border-color: #a7e3c0; background: linear-gradient(135deg, #f4fdf7, #eafaf0); }
.wish-head { display: flex; gap: 10px; align-items: flex-start; }
.wish-emoji { font-size: 26px; line-height: 1.2; }
.wish-title { font-size: 15px; font-weight: 800; }
.wish-price-row { display: flex; gap: 24px; margin: 10px 0 4px; }
.wish-cur { font-size: 22px; font-weight: 800; color: var(--teal-d); }
.wish-tgt { font-size: 22px; font-weight: 800; color: var(--muted); }
.wish-diff { font-size: 11px; font-weight: 800; margin-left: 4px; }
.wish-diff.good { color: var(--teal-d); }
.wish-diff.bad { color: #dc2626; }
.wish-hist { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0 0; font-family: ui-monospace, Consolas, monospace; font-size: 10px; color: var(--muted); }
.wish-hist span { background: rgba(107, 122, 147, .1); border-radius: 6px; padding: 2px 6px; }
.wish-quick { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 8px 0 4px; }
.wish-quick .list-sub { width: 100%; }
.wish-store { background: rgba(107, 122, 147, .08); border: 1px solid rgba(107, 122, 147, .25); color: var(--ink); }
.wish-store:active { background: rgba(7, 168, 54, .12); border-color: var(--teal); }

/* ---------------- committee pots ---------------- */
.pot-card.committee { border: 1.5px solid #c7d2fe; }
.pot-card.committee .pot-meta { font-weight: 800; }
.pay-ok { color: var(--teal-d); }
.pay-due { color: var(--muted); }
.pay-ok::before { content: ""; }
.chip.done { font-size: 12px; font-weight: 800; color: var(--teal-d); background: rgba(13, 148, 136, .12); border-radius: 20px; padding: 7px 12px; white-space: nowrap; }
.chip { font-size: 12px; font-weight: 800; color: var(--muted); background: rgba(107, 122, 147, .12); border-radius: 20px; padding: 7px 12px; white-space: nowrap; }
.muted-card { opacity: .62; filter: grayscale(.35); }
.seg { display: flex; gap: 8px; margin: 6px 0 10px; }
.seg-btn { flex: 1; border: 1.5px solid var(--line); background: var(--card); border-radius: 12px; padding: 9px 10px; font-size: 13px; font-weight: 800; color: var(--muted); cursor: pointer; }
.seg-btn.active { background: var(--grad); color: #fff; border-color: transparent; box-shadow: 0 4px 14px rgba(37, 99, 235, .3); }

/* payout order strip on committee pots */
.ord-strip { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 4px 0 10px; font-size: 12px; }
.ord-label { color: var(--muted); font-weight: 800; }
.ord-flow { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.ord-chip { display: inline-flex; align-items: center; gap: 3px; border-radius: 20px; padding: 3px 9px; font-weight: 800; background: #f1f4fa; color: #6b7a93; }
.ord-chip.ord-done { background: #e7f9ee; color: #1d7a44; }
.ord-chip.ord-now { background: #fef3c7; color: #b45309; box-shadow: 0 0 0 1.5px #fbbf24 inset; }
.ord-chip.ord-next { background: #f1f4fa; color: #6b7a93; }
.ord-arrow { color: #b8c2d4; font-weight: 800; }
[dir="rtl"] .ord-flow { flex-direction: row-reverse; }
  /* ---------- Settings: policy links + account deletion ---------- */ .settings-links { display: flex; gap: 14px; justify-content: center; margin: 14px 0 6px; font-size: 12px; } .settings-links a { color: var(--muted); text-decoration: underline; } .btn.danger { background: #dc2626; color: #fff; border: none; box-shadow: 0 4px 14px rgba(220, 38, 38, .25); } .btn.danger:hover { background: #b91c1c; } .danger-row { width: 100%; margin-top: 12px; }  .login-policy { margin-top: 14px; font-size: 12px; color: var(--muted); text-align: center; } .login-policy a { color: var(--muted); text-decoration: underline; } 

/* ---------- Partnerships ---------- */
.pt-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.pt-row select { flex: 1; min-width: 0; }
.pt-row input { flex: 1; min-width: 60px; }
.pt-row .pt-del { flex: none; }
.pt-me { background: rgba(128,128,128,.08); border-radius: 10px; padding: 6px 8px; }
.pt-me-label { flex: 1; font-weight: 600; white-space: nowrap; }
.pt-me-label small { font-weight: 400; color: var(--muted); }
.pnl { font-weight: 900; font-size: 15px; white-space: nowrap; }
.partnership-modal .modal { max-width: 480px; }
.pt-detail-head { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.pt-detail-head b { display: block; }
.pt-detail-head small { color: var(--muted); }
.pt-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 10px 0; }
.pt-sum-box { background: #f6f8fc; border-radius: 12px; padding: 8px; text-align: center; }
.pt-sum-box small { display: block; color: var(--muted); font-size: 10px; font-weight: 800; }
.pt-sum-box b { font-size: 14px; }
[dir="rtl"] .pt-summary { direction: rtl; }
.pt-you { text-align: center; font-weight: 800; margin: 4px 0 10px; }
.pt-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.pt-actions .btn-sm { flex: 1; white-space: nowrap; }
.pt-members { margin: 8px 0; }
.pt-ledger-title { font-size: 12px; font-weight: 800; color: var(--muted); margin: 10px 0 4px; }
.pt-ledger .list-sub small { color: var(--muted); font-size: 10px; }
.green { color: #0f9d58; }
.red { color: #dc2626; }

/* KnotX custom icons (nav / logo / sheet / empty / avatar / landing) */
.nav-ic { width: 1.15em; height: 1.15em; vertical-align: -0.22em; }
.avatar-ic { width: 62%; height: 62%; vertical-align: middle; }
.ic-svg { width: 1.5em; height: 1.5em; vertical-align: -0.35em; }
