@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@400;500;600;700;800&display=swap');

:root {
  --primary: #22c55e;
  --primary-dark: #15803d;
  --bg: #f4f7f5;
  --card: #ffffff;
  --text: #17211b;
  --muted: #718078;
  --border: #e4ebe6;
  --danger: #ef4444;
  --income: #16a34a;
  --expense: #dc2626;
  --shadow: 0 18px 50px rgba(25, 62, 39, 0.08);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  background: var(--bg);
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Tajawal", system-ui, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top right, rgba(34,197,94,.12), transparent 34%),
    var(--bg);
}

body.auth-locked {
  overflow: hidden;
}

body.auth-locked .app-shell {
  display: none;
}

.auth-screen {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: grid;
  place-items: center;
  padding: max(22px, env(safe-area-inset-top)) 18px max(22px, env(safe-area-inset-bottom));
  background:
    radial-gradient(circle at 72% 14%, rgba(34,197,94,.16), transparent 34%),
    var(--bg);
}

.auth-screen[hidden] {
  display: none;
}

.auth-card {
  width: min(100%, 390px);
  display: grid;
  gap: 12px;
  padding: 24px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 26px;
  box-shadow: var(--shadow);
}

.auth-logo {
  display: grid;
  place-items: center;
  width: 68px;
  height: 68px;
  margin-bottom: 4px;
  border-radius: 22px;
  background: rgba(34,197,94,.13);
  border: 1px solid rgba(34,197,94,.16);
}

.auth-logo img {
  width: 48px;
  height: 48px;
  border-radius: 16px;
}

.auth-card h1 {
  font-size: 1.45rem;
}

.auth-card > p {
  color: var(--muted);
  font-weight: 700;
}

.auth-error {
  min-height: 20px;
  color: var(--danger) !important;
  font-size: .86rem;
}

.splash-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 10px;
  padding: 28px;
  color: #fff;
  text-align: center;
  background:
    radial-gradient(circle at 70% 18%, rgba(255, 255, 255, .18), transparent 30%),
    linear-gradient(145deg, #22c55e, #15803d);
  transition: opacity .32s ease, visibility .32s ease;
}

.splash-screen.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.splash-mark {
  display: grid;
  place-items: center;
  width: 86px;
  height: 86px;
  border-radius: 26px;
  background: rgba(255, 255, 255, .18);
  border: 1px solid rgba(255, 255, 255, .26);
  box-shadow: 0 18px 45px rgba(0, 0, 0, .16);
}

.splash-mark img {
  width: 58px;
  height: 58px;
  border-radius: 18px;
}

.splash-screen h1 {
  margin-top: 8px;
  font-size: 1.9rem;
  font-weight: 900;
}

.splash-screen p {
  color: rgba(255, 255, 255, .82);
  font-size: .92rem;
  font-weight: 800;
}

body,
button,
input,
select {
  -webkit-font-smoothing: antialiased;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: 100%;
  max-width: 680px;
  min-height: 100vh;
  margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) 18px calc(92px + env(safe-area-inset-bottom));
}

.topbar,
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar {
  margin-bottom: 18px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 1.8rem;
}

h2 {
  font-size: 1.15rem;
}

.eyebrow {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: .82rem;
  font-weight: 700;
}

.balance-card {
  padding: 26px;
  border-radius: 28px;
  color: #fff;
  background: linear-gradient(145deg, #22c55e, #15803d);
  box-shadow: 0 20px 50px rgba(21,128,61,.25);
}

.balance-card span,
.balance-card small {
  display: block;
  opacity: .86;
}

.balance-card strong {
  display: block;
  margin: 12px 0 8px;
  font-size: clamp(2rem, 9vw, 3.2rem);
  letter-spacing: -1px;
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 14px 0;
}

.stat-card,
.section-card {
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.stat-card {
  padding: 18px;
  border-radius: 20px;
}

.stat-card span {
  display: block;
  color: var(--muted);
  margin-bottom: 6px;
}

.stat-card strong {
  font-size: 1.15rem;
}

.stat-card.income strong {
  color: var(--income);
}

.stat-card.expense strong {
  color: var(--expense);
}

.section-card {
  margin-top: 14px;
  padding: 20px;
  border-radius: 24px;
}

.transaction-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 18px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: .92rem;
  font-weight: 700;
}

input,
select {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  color: var(--text);
  background: #fbfdfb;
  border: 1px solid var(--border);
  border-radius: 14px;
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(34,197,94,.12);
}

.full-width {
  grid-column: 1 / -1;
}

.primary-btn,
.ghost-btn {
  border: 0;
  border-radius: 14px;
  font-weight: 800;
}

.primary-btn {
  min-height: 50px;
  color: #fff;
  background: var(--primary);
}

.primary-btn:hover {
  background: var(--primary-dark);
}

.ghost-btn {
  padding: 10px 16px;
  color: var(--primary-dark);
  background: rgba(34,197,94,.12);
}

.danger-link {
  padding: 0;
  color: var(--danger);
  background: transparent;
  border: 0;
  font-weight: 700;
}

.form-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}

.empty-state {
  padding: 28px 8px 12px;
  color: var(--muted);
  text-align: center;
}

.transactions-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.transaction-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px;
  background: #fbfdfb;
  border: 1px solid var(--border);
  border-radius: 16px;
}

.transaction-item h3 {
  margin: 0 0 4px;
  font-size: 1rem;
}

.transaction-item small {
  color: var(--muted);
}

.transaction-amount {
  white-space: nowrap;
  font-weight: 800;
}

.transaction-amount.income {
  color: var(--income);
}

.transaction-amount.expense {
  color: var(--expense);
}

.transaction-amount.transfer {
  color: var(--muted);
  font-weight: 800;
}

.bottom-nav {
  position: fixed;
  z-index: 10;
  right: 50%;
  bottom: 0;
  transform: translateX(50%);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  width: 100%;
  max-width: 680px;
  padding: 10px 18px calc(10px + env(safe-area-inset-bottom));
  background: rgba(255,255,255,.92);
  border-top: 1px solid var(--border);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}

.bottom-nav button {
  min-height: 44px;
  padding: 0 6px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 12px;
  font-weight: 700;
}

.bottom-nav button.active {
  color: var(--primary-dark);
  background: rgba(34,197,94,.1);
}

@media (max-width: 480px) {
  .transaction-form {
    grid-template-columns: 1fr;
  }

  .full-width {
    grid-column: auto;
  }

  .bottom-nav {
    padding-inline: 10px;
  }

  .bottom-nav button {
    font-size: .78rem;
  }
}

/* Category modal */
.modal {
  position: fixed;
  inset: 0;
  display: block;
  z-index: 1000;
}
/* ensure hidden labels stay hidden across styles */
label[hidden] { display: none !important; }
.modal[hidden] { display: none; }
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.35);
}
.modal-panel {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 94%;
  max-width: 720px;
  max-height: 80vh;
  background: var(--card);
  border-radius: 12px;
  padding: 16px;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0,0,0,0.25);
}
.category-group { margin-bottom: 8px; }
.category-group-header { font-weight:800; margin-bottom:6px; }
.category-crud-form {
  display: grid;
  grid-template-columns: 1fr 120px 1fr auto auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.category-crud-form input,
.category-crud-form select {
  min-height: 40px;
}

.category-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 6px 0 8px;
}

.category-row-actions .ghost-btn,
.category-row-actions .danger-link {
  min-height: 32px;
  padding: 6px 10px;
  border-radius: 10px;
  font-size: .78rem;
}

#categoryModal .category-crud-form,
#categoryModal .category-row-actions {
  display: none;
}

.category-manager-list {
  display: grid;
  gap: 10px;
}

.manager-category-group {
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255, 255, 255, .7);
}

.category-manager-child {
  display: grid;
  gap: 6px;
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 12px;
  background: #fbfdfb;
}

.child-actions {
  margin-inline-start: 16px;
}

.category-modal-item {
  display: inline-block;
  margin: 4px 6px 4px 0;
  padding: 8px 12px;
  border-radius: 12px;
  background: #f4f7f5;
  border: 1px solid var(--border);
}
.category-modal-item:hover { background: #eef7ee; }

@media (max-width: 560px) {
  .category-crud-form {
    grid-template-columns: 1fr 1fr;
  }

  .category-crud-form input,
  .category-crud-form select {
    grid-column: span 2;
  }
}

/* Wallet cards (dashboard style) */
.wallet-tabs {
  display: flex;
  gap: 10px;
  padding: 12px 0 0;
  border-bottom: 1px solid rgba(112, 121, 113, 0.18);
}
.wallet-tab {
  padding: 10px 18px;
  border-radius: 14px 14px 0 0;
  background: rgba(34,197,94,.08);
  border: 1px solid transparent;
  color: var(--muted);
  font-weight: 800;
}
.wallet-tab.active {
  background: #fff;
  border-color: rgba(34,197,94,.15);
  color: var(--text);
}
.wallet-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
.wallet-card {
  position: relative;
  border-radius: 16px;
  color: #fff;
  padding: 18px;
  overflow: hidden;
  min-height: 96px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 18px 40px rgba(0,0,0,0.12);
}
.wallet-card .wallet-name { font-weight:800; font-size:1rem; }
.wallet-card .wallet-balance { font-size:1.6rem; font-weight:900; margin-top:6px; }
.wallet-card .wallet-meta { display:flex;justify-content:space-between;align-items:center;margin-top:8px; }
.wallet-actions { display:flex; gap:8px; }
.wallet-action-btn { background: rgba(255,255,255,0.12); color: #fff; padding:8px 10px; border-radius:10px; border:0; }
.wallet-eye-btn {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  color: #fff;
  background: rgba(255,255,255,0.16);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 999px;
}
.wallet-eye-btn svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.wallet-hidden {
  opacity: .68;
}
.wallet-hidden::after {
  content: "";
  position: absolute;
  inset: 50% -12px auto;
  height: 3px;
  background: rgba(255,255,255,.9);
  transform: rotate(-8deg);
  transform-origin: center;
}
.wallet-hidden .wallet-balance {
  text-decoration: line-through;
  text-decoration-thickness: 3px;
}

.settings-list {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.settings-block {
  display: grid;
  gap: 14px;
  padding: 16px;
  background: #fbfdfb;
  border: 1px solid var(--border);
  border-radius: 16px;
}

.settings-block h3 {
  margin: 0 0 6px;
  font-size: 1rem;
}

.settings-block p,
.settings-status {
  margin: 0;
  color: var(--muted);
  font-size: .9rem;
}

.settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.settings-actions .primary-btn,
.settings-actions .ghost-btn,
.file-import-btn {
  min-height: 44px;
  padding: 10px 16px;
}

.file-import-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--primary-dark);
  background: rgba(34,197,94,.12);
  border: 0;
  border-radius: 14px;
  font-weight: 800;
  cursor: pointer;
}

.settings-status:not(:empty) {
  padding: 12px;
  background: rgba(34,197,94,.1);
  border: 1px solid rgba(34,197,94,.18);
  border-radius: 14px;
  color: var(--primary-dark);
  font-weight: 700;
}

.reports-summary,
.reports-grid {
  display: block;
  margin-top: 18px;
}

.small-grid {
  margin-top: 12px;
}

.report-card {
  display: block;
  padding: 16px;
  background: #fbfdfb;
  border: 1px solid var(--border);
  border-radius: 16px;
}

.report-card + .report-card {
  margin-top: 10px;
}

.report-card span {
  display: block;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 8px;
}

.report-card strong {
  display: block;
  font-size: 1.2rem;
  font-weight: 900;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.report-card.income strong {
  color: var(--income);
}

.report-card.expense strong {
  color: var(--expense);
}

.report-section {
  margin-top: 22px;
  padding-top: 2px;
}

.compact-heading h3 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.4;
}

.report-list {
  display: block;
  margin-top: 12px;
}

.report-row {
  display: block;
  padding: 14px;
  background: #fbfdfb;
  border: 1px solid var(--border);
  border-radius: 16px;
}

.report-row + .report-row {
  margin-top: 10px;
}

.report-row-main {
  display: block;
}

.report-row-main strong,
.report-row-side strong {
  display: block;
  font-weight: 900;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.report-row-main span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: .84rem;
}

.report-row-side {
  display: block;
  margin-top: 10px;
  text-align: right;
}

.report-bar {
  display: block;
  width: 100%;
  height: 7px;
  margin-top: 8px;
  overflow: hidden;
  background: #e8f0eb;
  border-radius: 999px;
}

.report-bar span {
  display: block;
  height: 100%;
  background: var(--primary);
  border-radius: inherit;
}

.compact-empty {
  padding: 16px 8px;
}

.debt-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 18px;
}

.compact-form {
  margin-top: 14px;
}

.inline-control {
  display: flex;
  gap: 8px;
  align-items: center;
}

.inline-control .ghost-btn {
  min-height: 48px;
  white-space: nowrap;
}

.people-list {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.person-card {
  padding: 16px;
  background: #fbfdfb;
  border: 1px solid var(--border);
  border-radius: 16px;
}

.person-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.person-card h3 {
  margin: 0 0 4px;
  font-size: 1.05rem;
}

.person-card small,
.person-debt-grid span {
  color: var(--muted);
}

.person-debt-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}

.person-debt-grid div {
  padding: 12px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid var(--border);
}

.person-debt-grid strong {
  display: block;
  margin-top: 5px;
  font-size: 1.05rem;
}

.income-text {
  color: var(--income);
}

.expense-text {
  color: var(--expense);
}

.debt-history-heading {
  margin-top: 22px;
}

.debt-entry-side,
.transaction-entry-side {
  display: grid;
  justify-items: end;
  gap: 8px;
}

.debt-entry-actions,
.transaction-entry-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.debt-entry-actions .ghost-btn,
.transaction-entry-actions .ghost-btn {
  min-height: 34px;
  padding: 6px 12px;
  border-radius: 10px;
}

@media (max-width: 480px) {
  .debt-summary,
  .person-debt-grid {
    grid-template-columns: 1fr;
  }

  .inline-control {
    align-items: stretch;
    flex-direction: column;
  }

  .form-actions {
    grid-template-columns: 1fr;
  }

  .debt-entry-item,
  .transaction-entry-item {
    align-items: stretch;
    flex-direction: column;
  }

  .debt-entry-side,
  .transaction-entry-side {
    justify-items: start;
  }
}

/* Gradient presets (cycle) */
.g1 { background: linear-gradient(135deg,#8b5cf6,#06b6d4); }
.g2 { background: linear-gradient(135deg,#7c3aed,#34d399); }
.g3 { background: linear-gradient(135deg,#ef4444,#f97316); }
.g4 { background: linear-gradient(135deg,#06b6d4,#60a5fa); }
.g5 { background: linear-gradient(135deg,#a78bfa,#c084fc); }

/* Mobile app polish */
:root {
  --app-max: 100%;
  --surface: #f7faf8;
  --soft-card: rgba(255,255,255,.94);
  --hairline: rgba(23,33,27,.08);
  --tap: rgba(34,197,94,.14);
  --shadow-soft: 0 10px 28px rgba(23,33,27,.07);
  --shadow-card: 0 16px 42px rgba(23,33,27,.10);
}

html,
body {
  overflow-x: hidden;
}

body {
  background:
    radial-gradient(circle at 82% 0%, rgba(34,197,94,.16), transparent 32%),
    linear-gradient(180deg, #f0f8f2 0%, #f8fbf9 48%, #f5f8f6 100%);
}

.app-shell {
  max-width: var(--app-max);
  padding: max(14px, env(safe-area-inset-top)) 14px calc(96px + env(safe-area-inset-bottom));
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  margin: -2px -14px 14px;
  padding: 12px 14px 10px;
  background: rgba(247,250,248,.86);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}

.topbar h1 {
  font-size: 1.55rem;
  letter-spacing: 0;
}

.eyebrow {
  color: #7b8b82;
  letter-spacing: 0;
}

.balance-card {
  position: relative;
  min-height: 174px;
  padding: 24px;
  border: 0;
  border-radius: 30px;
  background:
    radial-gradient(circle at 18% 15%, rgba(255,255,255,.22), transparent 28%),
    linear-gradient(145deg, #28c76a, #12823f);
  box-shadow: 0 20px 46px rgba(18,130,63,.24);
  overflow: hidden;
}

.balance-card::after {
  content: "";
  position: absolute;
  inset: auto -42px -54px auto;
  width: 154px;
  height: 154px;
  border: 28px solid rgba(255,255,255,.10);
  border-radius: 50%;
}

.balance-card strong {
  position: relative;
  z-index: 1;
  font-size: 2.55rem;
  line-height: 1.15;
  letter-spacing: 0;
}

.stats-grid,
.debt-summary,
.person-debt-grid {
  gap: 10px;
}

.stat-card,
.section-card,
.settings-block,
.report-card,
.report-row,
.person-card,
.transaction-item {
  border-color: var(--hairline);
  background: var(--soft-card);
  box-shadow: var(--shadow-soft);
}

.stat-card {
  min-height: 92px;
  padding: 16px;
  border-radius: 22px;
}

.stat-card strong {
  display: block;
  line-height: 1.35;
}

.section-card {
  margin-top: 14px;
  padding: 18px;
  border-radius: 26px;
}

.section-heading {
  align-items: flex-start;
}

.section-heading h2 {
  font-size: 1.08rem;
  line-height: 1.45;
}

.transaction-form {
  display: block;
}

.transaction-form label,
.transaction-form .form-actions {
  margin-top: 13px;
}

.transaction-form label:first-child {
  margin-top: 0;
}

label {
  font-size: .88rem;
}

input,
select {
  min-height: 52px;
  border-radius: 17px;
  border-color: var(--hairline);
  background: #fff;
  font-size: 1rem;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.9);
}

select {
  background-image:
    linear-gradient(45deg, transparent 50%, #7b8b82 50%),
    linear-gradient(135deg, #7b8b82 50%, transparent 50%);
  background-position:
    left 18px center,
    left 12px center;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-left: 34px;
}

.primary-btn,
.ghost-btn,
.file-import-btn {
  min-height: 50px;
  border-radius: 17px;
  -webkit-tap-highlight-color: transparent;
}

.primary-btn {
  background: linear-gradient(145deg, #2bd16f, #16a34a);
  box-shadow: 0 12px 26px rgba(22,163,74,.22);
}

.ghost-btn,
.file-import-btn {
  background: var(--tap);
}

.form-actions {
  display: block;
}

.form-actions .ghost-btn {
  width: 100%;
  margin-top: 10px;
}

.transaction-item {
  align-items: stretch;
  flex-direction: column;
  padding: 15px;
  border-radius: 20px;
}

.transaction-entry-side,
.debt-entry-side {
  display: flex;
  align-items: center;
  justify-content: space-between;
  justify-items: initial;
  margin-top: 4px;
}

.transaction-entry-actions,
.debt-entry-actions {
  gap: 8px;
}

.danger-link {
  min-height: 34px;
  padding: 6px 10px;
}

.wallet-tabs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  padding: 4px;
  border: 1px solid var(--hairline);
  border-radius: 18px;
  background: #f5faf7;
}

.wallet-tab {
  border-radius: 14px;
  padding: 12px 10px;
  background: transparent;
}

.wallet-tab.active {
  background: #fff;
  box-shadow: 0 8px 20px rgba(23,33,27,.07);
}

.wallet-card {
  min-height: 148px;
  padding: 20px;
  border-radius: 26px;
  box-shadow: 0 18px 36px rgba(0,0,0,.14);
}

.wallet-card .wallet-balance {
  font-size: 1.85rem;
  line-height: 1.2;
}

.wallet-action-btn {
  background: rgba(255,255,255,.18);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 13px;
}

.wallet-eye-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
}

.reports-summary {
  margin-top: 16px;
}

.report-card {
  position: relative;
  min-height: 82px;
  padding: 15px 16px;
  border-radius: 22px;
}

.report-card + .report-card {
  margin-top: 9px;
}

.report-card span {
  margin-bottom: 6px;
  font-size: .86rem;
}

.report-card strong {
  font-size: 1.32rem;
}

.report-card.income {
  border-right: 4px solid rgba(22,163,74,.5);
}

.report-card.expense {
  border-right: 4px solid rgba(220,38,38,.48);
}

.report-section {
  padding: 16px;
  border: 1px solid var(--hairline);
  border-radius: 24px;
  background: rgba(255,255,255,.72);
}

.report-section + .report-section {
  margin-top: 14px;
}

.compact-heading {
  margin-bottom: 10px;
}

.report-row {
  padding: 14px;
  border-radius: 18px;
  box-shadow: none;
}

.report-row-main strong {
  font-size: .98rem;
}

.report-row-side strong {
  font-size: 1.05rem;
}

.report-bar {
  height: 8px;
  background: #edf4ef;
}

.report-bar span {
  background: linear-gradient(90deg, #16a34a, #22c55e);
}

.person-card {
  border-radius: 22px;
}

.inline-control {
  align-items: stretch;
  flex-direction: column;
}

.bottom-nav {
  right: 50%;
  bottom: 0;
  max-width: var(--app-max);
  margin: 0;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  border-width: 1px 0 0;
  border-style: solid;
  border-color: rgba(23,33,27,.08);
  border-radius: 0;
  background: rgba(255,255,255,.94);
  box-shadow: 0 -8px 28px rgba(23,33,27,.10);
}

.bottom-nav button {
  display: flex;
  min-width: 0;
  min-height: 56px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 3px;
  padding: 6px 2px;
  border-radius: 18px;
  font-size: .72rem;
}

.bottom-nav button::before {
  display: block;
  font-size: 1.08rem;
  line-height: 1;
  color: currentColor;
}

.bottom-nav button:nth-child(1)::before { content: "⌂"; }
.bottom-nav button:nth-child(2)::before { content: "▣"; }
.bottom-nav button:nth-child(3)::before { content: "⇄"; }
.bottom-nav button:nth-child(4)::before { content: "◷"; }
.bottom-nav button:nth-child(5)::before { content: "⚙"; }

.bottom-nav button.active {
  color: #0f7a3a;
  background: rgba(34,197,94,.14);
}

@media (min-width: 520px) {
  body {
    background:
      linear-gradient(90deg, #26302b 0, #26302b calc(50% - 250px), transparent calc(50% - 250px), transparent calc(50% + 250px), #26302b calc(50% + 250px)),
      radial-gradient(circle at 82% 0%, rgba(34,197,94,.16), transparent 32%),
      linear-gradient(180deg, #f0f8f2 0%, #f8fbf9 48%, #f5f8f6 100%);
  }
}

@media (max-width: 360px) {
  .app-shell {
    padding-right: 12px;
    padding-left: 12px;
  }

  .balance-card strong {
    font-size: 2.15rem;
  }

  .bottom-nav button {
    font-size: .66rem;
  }
}

/* Compact mobile sizing */
:root {
  --app-max: 100%;
}

.app-shell {
  padding: max(10px, env(safe-area-inset-top)) 12px calc(82px + env(safe-area-inset-bottom));
}

.topbar {
  margin: -2px -12px 10px;
  padding: 9px 12px 7px;
}

.topbar h1 {
  font-size: 1.34rem;
}

.refresh-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  min-width: 34px;
  padding: 0;
  color: var(--primary-dark);
  background: rgba(34,197,94,.13);
  border: 1px solid rgba(34,197,94,.16);
  border-radius: 50%;
  font-size: 1.1rem;
  font-weight: 900;
  line-height: 1;
  -webkit-tap-highlight-color: transparent;
}

.eyebrow {
  font-size: .76rem;
}

.balance-card {
  min-height: 136px;
  padding: 18px;
  border-radius: 23px;
}

.balance-card strong {
  margin: 8px 0 6px;
  font-size: 2.08rem;
}

.balance-card small {
  font-size: .82rem;
}

.stats-grid {
  gap: 9px;
  margin: 10px 0;
}

.stat-card {
  min-height: 76px;
  padding: 12px;
  border-radius: 17px;
}

.stat-card span,
.report-card span {
  font-size: .8rem;
}

.stat-card strong {
  font-size: 1rem;
}

.section-card {
  margin-top: 10px;
  padding: 14px;
  border-radius: 20px;
}

.section-heading h2 {
  font-size: .98rem;
}

.transaction-form label,
.transaction-form .form-actions {
  margin-top: 9px;
}

label {
  gap: 5px;
  font-size: .82rem;
}

input,
select {
  min-height: 44px;
  padding-right: 12px;
  border-radius: 13px;
  font-size: .92rem;
}

select {
  background-position: left 17px center, left 11px center;
  padding-left: 32px;
}

.primary-btn,
.ghost-btn,
.file-import-btn {
  min-height: 42px;
  padding: 8px 13px;
  border-radius: 13px;
  font-size: .9rem;
}

.transaction-item {
  padding: 11px;
  border-radius: 15px;
}

.transaction-item h3,
.person-card h3 {
  font-size: .92rem;
}

.transaction-item small {
  font-size: .78rem;
}

.transaction-amount {
  font-size: .95rem;
}

.wallet-tabs {
  gap: 6px;
  padding: 3px;
  border-radius: 15px;
}

.wallet-tab {
  padding: 8px 7px;
  border-radius: 12px;
  font-size: .88rem;
}

.wallet-card {
  min-height: 118px;
  padding: 15px;
  border-radius: 20px;
}

.wallet-card .wallet-name {
  font-size: .92rem;
}

.wallet-card .wallet-balance {
  font-size: 1.45rem;
}

.wallet-eye-btn {
  top: 10px;
  left: 10px;
  width: 29px;
  height: 29px;
}

.wallet-eye-btn svg {
  width: 16px;
  height: 16px;
}

.wallet-action-btn {
  padding: 6px 9px;
  border-radius: 10px;
  font-size: .82rem;
}

.report-card {
  min-height: 66px;
  padding: 11px 12px;
  border-radius: 16px;
}

.report-card strong {
  font-size: 1.08rem;
}

.report-section {
  margin-top: 14px;
  padding: 12px;
  border-radius: 18px;
}

.report-row {
  padding: 10px;
  border-radius: 14px;
}

.report-row-main strong {
  font-size: .9rem;
}

.report-row-main span {
  font-size: .76rem;
}

.report-row-side strong {
  font-size: .96rem;
}

.person-card,
.settings-block {
  padding: 12px;
  border-radius: 17px;
}

.bottom-nav {
  padding: 5px 7px calc(5px + env(safe-area-inset-bottom));
}

.bottom-nav button {
  min-height: 46px;
  border-radius: 13px;
  font-size: .64rem;
}

.bottom-nav button::before {
  font-size: .92rem;
}

.category-picker {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px;
  align-items: center;
}

.category-picker-btn {
  min-height: 42px;
  padding-inline: 14px;
  white-space: nowrap;
}

.selected-category-name {
  min-height: 42px;
  display: flex;
  align-items: center;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: rgba(255, 255, 255, .72);
  color: var(--text);
  font-size: .86rem;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

input[type="date"] {
  min-height: 42px;
  color: var(--text);
}
