:root {
  --bg: #f2f6f4;
  --app: #ffffff;
  --card: #ffffff;
  --text: #13231f;
  --muted: #6f7f7a;
  --line: #dce8e4;
  --primary: #005f4b;
  --primary-dark: #00473a;
  --amber: #d99a28;
  --danger: #bd3d38;
  --ok: #16824f;
  --shadow: 0 18px 44px rgba(13, 81, 71, 0.12);
  font-family: "Segoe UI", "Dubai", "Noto Kufi Arabic", "Noto Sans Arabic", Tahoma, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: radial-gradient(circle at top, rgba(16, 107, 92, 0.15), transparent 34%), var(--bg);
  font-family: "Segoe UI", "Dubai", "Noto Kufi Arabic", "Noto Sans Arabic", Tahoma, Arial, sans-serif;
  font-feature-settings: "kern";
  text-rendering: optimizeLegibility;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.android-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.android-app {
  position: relative;
  width: min(430px, 100%);
  min-height: min(920px, calc(100vh - 48px));
  max-height: calc(100vh - 48px);
  overflow: hidden;
  border: 1px solid rgba(16, 107, 92, 0.16);
  border-radius: 28px;
  background: var(--app);
  box-shadow: var(--shadow);
}

.android-app,
.m-screen {
  overflow-x: hidden;
  scrollbar-width: none;
}

.android-app::-webkit-scrollbar,
.m-screen::-webkit-scrollbar,
.operations-list::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

.m-screen {
  height: 100%;
  max-height: inherit;
  overflow-y: auto;
  padding: 14px 18px 96px;
  scrollbar-width: none;
}

.status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 28px;
  margin-bottom: 18px;
  color: #070b0a;
  font-size: 17px;
  font-weight: 700;
}

.home-header {
  display: grid;
  grid-template-columns: 1fr auto 44px;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.app-topbar {
  margin-bottom: 10px;
}

.home-header button,
.header-icons button {
  position: relative;
  width: 44px;
  height: 44px;
  border: 0;
  background: transparent;
  color: #111;
}

.home-header svg {
  width: 29px;
  height: 29px;
  stroke-width: 2.5;
}

.header-icons {
  display: flex;
  gap: 14px;
}

.header-icons i {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #e79616;
}

.brand-title {
  color: var(--primary);
  font-size: 29px;
  font-weight: 800;
}

.greeting {
  text-align: right;
  margin-bottom: 18px;
}

.greeting h2 {
  margin: 0 0 6px;
  font-size: 22px;
  line-height: 1.25;
}

.greeting p {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
}

.screen-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.screen-header span {
  color: var(--muted);
  font-size: 13px;
}

.screen-header h2 {
  margin: 4px 0 0;
  font-size: 26px;
  line-height: 1.2;
}

.avatar,
.m-mini {
  min-width: 44px;
  min-height: 44px;
  border: 0;
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #fff;
  background: var(--primary);
}

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

.m-mini.icon-only {
  width: 44px;
  min-width: 44px;
  padding: 0;
}

.m-mini.icon-only svg {
  width: 20px;
  height: 20px;
}

.budget-card {
  display: grid;
  grid-template-columns: 1fr 112px 1fr;
  gap: 12px;
  align-items: center;
  min-height: 138px;
  padding: 18px;
  border-radius: 18px;
  color: #fff;
  background:
    radial-gradient(circle at 70% 25%, rgba(255, 255, 255, 0.12), transparent 28%),
    linear-gradient(135deg, #006246, #006f52 50%, #00573f);
  box-shadow: 0 18px 36px rgba(0, 90, 66, 0.24);
}

.budget-side {
  display: grid;
  gap: 5px;
  min-width: 0;
  text-align: center;
}

.budget-side.end {
  text-align: right;
}

.budget-side span,
.budget-side small {
  color: rgba(255, 255, 255, 0.78);
  font-size: 13px;
}

.budget-side strong {
  color: rgba(255, 255, 255, 0.9);
  font-size: 25px;
  line-height: 1;
}

.budget-side .soft {
  color: #71d99d;
  font-size: 21px;
}

.budget-side em {
  justify-self: center;
  margin-top: 6px;
  padding: 6px 10px;
  border-radius: 8px;
  color: var(--primary);
  background: rgba(255, 255, 255, 0.78);
  font-style: normal;
  font-size: 12px;
}

.donut {
  width: 106px;
  height: 106px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(#68ce8c calc(var(--value) * 1%), #ffffff 0);
  position: relative;
}

.donut::before {
  content: "";
  position: absolute;
  inset: 16px;
  border-radius: 50%;
  background: #00684d;
}

.donut b,
.donut span {
  position: relative;
  z-index: 1;
}

.donut b {
  font-size: 25px;
}

.donut span {
  margin-top: 30px;
  color: #fff;
  font-size: 12px;
  position: absolute;
}

.m-track {
  width: 100%;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e6e6e6;
}

.m-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
}

.reference-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 14px 0;
  border: 1px solid #dedede;
  border-radius: 18px;
  background: #fff;
  overflow: hidden;
}

.reference-actions button,
.bottom-nav button,
.section-title button,
.chips button {
  border: 0;
  border-radius: 18px;
  background: var(--card);
  color: var(--primary);
}

.reference-actions button {
  min-height: 86px;
  display: grid;
  place-items: center;
  grid-template-columns: auto 1fr;
  gap: 10px;
  padding: 12px;
  color: #202523;
  border-radius: 0;
  border-inline-start: 1px solid #dedede;
}

.reference-actions button:first-child {
  border-inline-start: 0;
}

.reference-actions span {
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  border-radius: 17px;
  color: var(--primary);
  background: #eef6f1;
}

.reference-actions b {
  font-size: 14px;
  line-height: 1.45;
  text-align: right;
}

.reference-actions svg {
  width: 28px;
  height: 28px;
  stroke-width: 2.2;
}

.metric-strip span,
.tx-card span,
.category-row span,
.review-item span,
.empty,
.soft-note {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.m-card {
  padding: 16px;
  margin-top: 14px;
}

.ref-card,
.review-ref-card,
.m-card {
  border: 1px solid #dedede;
  border-radius: 18px;
  background: #fff;
  box-shadow: none;
}

.ref-card,
.review-ref-card {
  padding: 18px;
  margin-top: 14px;
}

.review-ref-card {
  border-color: #f2a51d;
  background: linear-gradient(90deg, #fffdf8, #fffaf0);
}

.review-ref-head,
.review-ref-row,
.ref-title,
.ref-category-row,
.last-row {
  display: grid;
  align-items: center;
}

.review-ref-head {
  grid-template-columns: 88px 1fr 44px;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid #eadfcb;
}

.review-ref-head button {
  min-height: 42px;
  border: 0;
  border-radius: 24px;
  color: #fff;
  background: linear-gradient(135deg, #e69800, #d37a00);
  font-weight: 700;
}

.review-ref-head h3,
.ref-title h3 {
  margin: 0;
  font-size: 18px;
}

.review-ref-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.review-ref-head > span,
.review-ref-row em,
.ref-category-row em {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 15px;
  color: #d98700;
  background: #fff1dc;
}

.review-ref-row {
  grid-template-columns: 90px 10px 100px 1fr 42px;
  gap: 10px;
  padding-top: 13px;
  font-size: 13px;
}

.review-ref-row i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #e69800;
}

.review-ref-row p,
.review-ref-row span {
  margin: 0;
  color: var(--muted);
}

.ref-title {
  grid-template-columns: auto 1fr;
  margin-bottom: 13px;
}

.ref-title button {
  border: 0;
  color: var(--primary);
  background: transparent;
  font-size: 15px;
}

.ref-title h3 {
  text-align: right;
}

.ref-category-list {
  display: grid;
}

.ref-category-row {
  grid-template-columns: 78px 42px 1fr 100px 42px;
  gap: 12px;
  min-height: 52px;
  border-top: 1px solid #e6e6e6;
}

.ref-category-row:first-child {
  border-top: 0;
}

.ref-category-row span,
.ref-category-row small {
  color: #1d2421;
}

.ref-category-row strong {
  text-align: right;
  font-size: 15px;
}

.ref-category-row em {
  color: var(--primary);
  background: #eef6f1;
}

.ref-line {
  height: 7px;
  border-radius: 999px;
  background: #e2e2e2;
  overflow: hidden;
}

.ref-line i {
  display: block;
  height: 100%;
  margin-inline-start: auto;
  margin-inline-end: 0;
  border-radius: inherit;
  background: var(--primary);
}

.ref-category-row.usage-warning .ref-line i {
  background: #d99a28;
}

.ref-category-row.usage-danger .ref-line i {
  background: #c94b3a;
}

.drawer-scrim {
  position: absolute;
  z-index: 30;
  inset: 0;
  background: rgba(19, 35, 31, 0.18);
}

.top-menu {
  position: absolute;
  z-index: 31;
  top: 10px;
  bottom: 10px;
  inset-inline-start: 10px;
  width: min(72%, 292px);
  display: grid;
  align-content: start;
  gap: 6px;
  padding: 14px 12px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 20px 45px rgba(19, 35, 31, 0.18);
  backdrop-filter: blur(12px);
}

.drawer-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 6px 12px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 8px;
}

.app-logo.mini {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  color: #fff;
  background-color: transparent;
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
}

.top-menu p {
  margin: 12px 8px 5px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.top-menu button {
  min-height: 42px;
  border: 0;
  border-radius: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  color: var(--primary);
  background: transparent;
}

.top-menu button.active,
.top-menu button:hover {
  background: #eef7f4;
}

.top-menu button svg {
  width: 18px;
  height: 18px;
}

.top-menu button span {
  font-size: 13px;
  font-weight: 700;
}

.is-ltr .top-menu {
  inset-inline-start: 10px;
  inset-inline-end: auto;
}

.loan-hero,
.loan-card {
  width: 100%;
  border: 0;
  border-radius: 18px;
  color: #fff;
  background: linear-gradient(135deg, #006246, #006f52 58%, #00573f);
  box-shadow: 0 14px 28px rgba(0, 90, 66, 0.18);
}

.loan-hero {
  padding: 18px;
  margin-bottom: 12px;
}

.loan-hero span,
.loan-hero small,
.loan-card span,
.loan-card small {
  color: rgba(255, 255, 255, 0.78);
}

.loan-hero strong {
  display: block;
  margin: 8px 0 4px;
  font-size: 28px;
}

.loan-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.loan-form-card {
  margin-bottom: 12px;
}

.loan-card {
  display: grid;
  grid-template-columns: 1fr 92px;
  gap: 14px;
  align-items: center;
  min-height: 105px;
  padding: 16px;
  text-align: inherit;
}

.loan-card.detail-top {
  margin-bottom: 12px;
}

.loan-card.active {
  outline: 3px solid rgba(217, 154, 40, 0.38);
}

.loan-card strong {
  display: block;
  margin: 4px 0 7px;
  font-size: 17px;
}

.loan-meter {
  display: grid;
  gap: 8px;
}

.loan-meter b {
  text-align: center;
  font-size: 18px;
}

.loan-card .m-track {
  background: rgba(255, 255, 255, 0.22);
}

.loan-card .m-fill {
  background: #9ae5b4;
}

.investment-home-card {
  margin-top: 12px;
}

.investment-home-body {
  display: grid;
  grid-template-columns: 112px 1fr;
  align-items: center;
  gap: 12px;
}

.investment-donut {
  width: 108px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(var(--segments));
  position: relative;
}

.investment-donut::before {
  content: "";
  position: absolute;
  inset: 12px;
  border-radius: inherit;
  background: #fff;
}

.investment-donut > div {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  text-align: center;
  gap: 1px;
  max-width: 72px;
}

.investment-donut strong {
  color: var(--primary);
  font-size: 12px;
  line-height: 1.15;
}

.investment-donut span {
  color: var(--muted);
  font-size: 10px;
}

.investment-legend {
  display: grid;
  gap: 7px;
}

.investment-legend button {
  display: grid;
  grid-template-columns: 9px 1fr auto;
  align-items: center;
  gap: 7px;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: inherit;
}

.investment-legend i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.investment-legend span {
  font-size: 12px;
  font-weight: 700;
}

.investment-legend b {
  color: var(--primary);
  font-size: 11px;
}

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

.investment-hero {
  display: grid;
  grid-template-columns: 1fr 112px;
  align-items: center;
  gap: 14px;
  padding: 18px;
  margin-bottom: 12px;
  border-radius: 18px;
  color: #fff;
  background: linear-gradient(135deg, #005f4b, #00785b 58%, #004b3c);
  box-shadow: 0 14px 28px rgba(0, 90, 66, 0.18);
}

.investment-hero span,
.investment-hero small {
  color: rgba(255, 255, 255, 0.78);
}

.investment-hero strong {
  display: block;
  margin: 8px 0 4px;
  font-size: 24px;
}

.mini-portfolio {
  width: 104px;
}

.mini-portfolio::before {
  background: #00644c;
}

.mini-portfolio strong,
.mini-portfolio span {
  color: #fff;
}

.investment-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.investment-card {
  position: relative;
  display: grid;
  grid-template-columns: 42px 1fr auto 34px;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
}

.investment-card > em {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: #eef7f4;
  font-style: normal;
}

.investment-card > em svg {
  width: 22px;
  height: 22px;
}

.investment-card-main {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.investment-card-main span,
.investment-card-main small {
  color: var(--muted);
  font-size: 11px;
}

.investment-card-main strong {
  font-size: 14px;
}

.investment-card > b {
  color: var(--primary);
  font-size: 12px;
  white-space: nowrap;
}

.investment-form {
  margin-bottom: 12px;
}

.compact-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.compact-form .m-button {
  grid-column: 1 / -1;
}

.loan-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.loan-stats div {
  padding: 10px;
  border-radius: 14px;
  background: #eef7f4;
}

.loan-stats span {
  color: var(--muted);
  font-size: 11px;
}

.loan-stats strong {
  display: block;
  margin-top: 4px;
  font-size: 12px;
}

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

.pay-form .m-button {
  grid-column: 1 / -1;
}

.payment-list {
  display: grid;
  gap: 7px;
  margin-top: 12px;
}

.payment-list article {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.payment-list article::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  order: -1;
}

.payment-list span {
  color: var(--muted);
  font-size: 12px;
}

.payment-list button {
  min-height: 30px;
  border: 0;
  border-radius: 10px;
  padding: 4px 9px;
  color: var(--danger);
  background: #fff1ef;
  font-size: 11px;
  font-weight: 700;
}

.compact-danger {
  min-height: 40px;
  margin: 4px 0 12px;
}

.category-editor,
.category-add-row {
  display: grid;
  gap: 10px;
}

.category-edit-row,
.category-add-row {
  display: grid;
  grid-template-columns: 1fr 110px auto;
  gap: 8px;
  align-items: end;
}

.remove-check {
  min-height: 48px;
  display: flex !important;
  align-items: center;
  gap: 6px !important;
  color: var(--danger) !important;
}

.remove-check input {
  width: auto;
  min-height: auto;
}

.report-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.report-stat {
  padding: 14px;
  border-radius: 16px;
  color: #fff;
  background: linear-gradient(135deg, #006246, #00513f);
}

.report-stat span,
.report-donut p {
  color: var(--muted);
  font-size: 12px;
}

.report-stat strong {
  display: block;
  margin-top: 6px;
  font-size: 18px;
}

.report-bars {
  display: grid;
  gap: 10px;
}

.report-bar {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}

.report-bar div {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  align-items: center;
  gap: 8px;
}

.report-bar span,
.report-bar small {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.report-bar span {
  white-space: nowrap;
}

.report-bar strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.report-bar i {
  height: 8px;
  border-radius: 99px;
  background: #e7ecea;
  overflow: hidden;
}

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

.column-chart {
  height: 150px;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  align-items: end;
}

.column-chart div {
  height: 100%;
  display: grid;
  align-items: end;
  gap: 6px;
}

.column-chart i {
  width: 100%;
  min-height: 4px;
  border-radius: 10px 10px 3px 3px;
  background: linear-gradient(180deg, #0b8062, #9ae5b4);
}

.column-chart span {
  text-align: center;
  color: var(--muted);
  font-size: 11px;
}

.line-chart {
  width: 100%;
  height: 150px;
}

.line-chart polyline {
  fill: none;
  stroke: var(--primary);
  stroke-width: 3;
  vector-effect: non-scaling-stroke;
}

.line-chart circle {
  fill: var(--amber);
}

.report-donut {
  display: grid;
  place-items: center;
  gap: 8px;
}

.report-small {
  width: 118px;
  height: 118px;
}

.budget-total-card {
  padding: 12px;
  border-radius: 16px;
  background: #eef7f4;
}

.budget-total-form {
  gap: 8px;
}

.icon-fab {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 14px;
  color: #fff;
  background: var(--primary);
  box-shadow: 0 10px 18px rgba(0, 95, 75, 0.18);
}

.icon-fab svg {
  width: 22px;
  height: 22px;
}

.budget-list-card {
  padding: 14px;
}

.budget-summary-list {
  display: grid;
  gap: 6px;
}

.budget-summary-row {
  position: relative;
  display: grid;
  grid-template-columns: 36px 1fr 92px 82px 34px;
  gap: 8px;
  align-items: center;
  min-height: 46px;
  padding: 6px 0;
  border-top: 1px solid #e6ebe8;
}

.budget-summary-row:first-child {
  border-top: 0;
}

.budget-summary-row em,
.report-bar em {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: var(--primary);
  background: #eef6f1;
  font-style: normal;
}

.budget-summary-row em svg,
.report-bar em svg {
  width: 19px;
  height: 19px;
}

.budget-summary-row strong {
  min-width: 0;
  font-size: 13px;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.budget-summary-row span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
}

.budget-summary-row b {
  color: var(--primary);
  font-size: 12px;
  text-align: end;
  white-space: nowrap;
}

.budget-row-action {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 11px;
  color: var(--primary);
  background: #eef7f4;
}

.budget-row-action svg {
  width: 17px;
  height: 17px;
}

.budget-action-menu {
  position: absolute;
  inset-inline-end: 2px;
  top: 42px;
  z-index: 3;
  min-width: 112px;
  display: grid;
  gap: 4px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fff;
  box-shadow: 0 14px 30px rgba(12, 33, 28, 0.14);
}

.budget-action-menu button {
  min-height: 32px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  text-align: start;
}

.budget-action-menu button:last-child {
  color: var(--danger);
  background: #fff1ef;
}

.category-add-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px dashed rgba(0, 95, 75, 0.28);
  border-radius: 16px;
  background: #fbfdfc;
}

.category-add-panel h3 {
  margin: 0;
  font-size: 14px;
}

.budget-item-fields {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.budget-item-fields label {
  min-width: 0;
}

.select-with-icon {
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 8px;
  align-items: center;
}

.select-with-icon em {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  color: var(--primary);
  background: #eef6f1;
  font-style: normal;
}

.select-with-icon em svg {
  width: 20px;
  height: 20px;
}

.gold-icon {
  color: #d99a28 !important;
  background: #fff6df !important;
}

.form-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.income-summary {
  color: #fff;
  background: linear-gradient(135deg, #006246, #00513f);
}

.income-summary span {
  color: rgba(255, 255, 255, 0.76);
  font-size: 12px;
}

.income-summary strong {
  display: block;
  margin-top: 6px;
  font-size: 26px;
}

.income-list {
  display: grid;
  gap: 6px;
}

.income-source-row {
  grid-template-columns: 36px 1fr 82px 82px 34px;
}

@media (max-width: 560px) {
  .category-edit-row,
  .category-add-row {
    grid-template-columns: 1fr;
  }

  .budget-summary-row,
  .income-source-row {
    grid-template-columns: 34px minmax(62px, 1fr) 72px 68px 32px;
    gap: 6px;
  }

  .budget-summary-row strong {
    font-size: 12px;
  }

  .budget-summary-row span,
  .budget-summary-row b {
    font-size: 10.5px;
  }

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

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

  .loan-card {
    min-height: 96px;
    grid-template-columns: 1fr 78px;
  }

  .loan-stats {
    grid-template-columns: 1fr;
  }
}

.last-row {
  grid-template-columns: 62px 1fr 88px 32px;
  gap: 8px;
  min-height: 42px;
  border-top: 1px solid #e6e6e6;
}

.last-row:first-of-type {
  border-top: 0;
}

.last-row span,
.last-row small {
  color: var(--muted);
  font-size: 11px;
}

.last-row strong {
  color: var(--primary);
  font-size: 12px;
  text-align: end;
  white-space: nowrap;
}

.last-row div {
  display: grid;
  gap: 3px;
  text-align: right;
  min-width: 0;
}

.last-row b {
  font-size: 12px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.last-row button {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 11px;
  color: var(--primary);
  background: #eef6f1;
}

.last-row button svg {
  width: 17px;
  height: 17px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.section-title h3 {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 17px;
}

.section-title button {
  min-height: 34px;
  padding: 0 12px;
  background: #eef7f4;
}

.category-list,
.tx-list,
.form,
.chips,
.budget-grid {
  display: grid;
  gap: 10px;
}

.category-row {
  display: grid;
  gap: 9px;
}

.category-row > div,
.rule-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

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

.settings-action-card {
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 2px 10px;
  align-items: center;
  min-height: 58px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fbfdfc;
  color: var(--ink);
  text-align: start;
}

.settings-action-card em {
  grid-row: span 2;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  color: var(--primary);
  background: #eef6f1;
  font-style: normal;
}

.settings-action-card em svg {
  width: 20px;
  height: 20px;
}

.settings-action-card span {
  font-size: 13px;
  font-weight: 800;
}

.settings-action-card small {
  color: var(--muted);
  font-size: 11px;
}

.settings-action-card.danger em {
  color: var(--danger);
  background: #fff1ef;
}

.alert-card {
  border-color: rgba(217, 154, 40, 0.36);
  background: #fff9ed;
}

.alert-card p {
  margin: 8px 0 0;
  color: #7a5015;
}

.review-item {
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.review-item:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.review-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.chips {
  grid-template-columns: repeat(3, 1fr);
}

.chips button {
  min-height: 38px;
  padding: 8px;
  background: #eef7f4;
}

.chips button:active,
.quick-actions button:active,
.bottom-nav button.active {
  color: #fff;
  background: var(--primary);
}

.tx-card {
  position: relative;
  display: grid;
  grid-template-columns: 38px 1fr auto 34px;
  align-items: center;
  gap: 9px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fbfdfc;
}

.operations-card {
  padding: 12px;
}

.operations-list {
  max-height: calc(100dvh - 210px);
  overflow-y: auto;
  padding-inline-end: 2px;
  scrollbar-width: none;
}

.expense-month-bar {
  margin-bottom: 10px;
}

.expense-month-bar label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.expense-month-bar select {
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 0 13px;
  color: var(--text);
  background: #fff;
}

.expense-summary-hero {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 10px;
  padding: 16px;
  margin-bottom: 12px;
  border-radius: 18px;
  color: #fff;
  background: linear-gradient(135deg, #005f4b, #00785b 60%, #004b3c);
  box-shadow: 0 14px 28px rgba(0, 90, 66, 0.16);
}

.expense-summary-hero div {
  display: grid;
  gap: 4px;
  align-content: center;
}

.expense-summary-hero span,
.expense-summary-hero small {
  color: rgba(255, 255, 255, 0.78);
  font-size: 11px;
}

.expense-summary-hero strong {
  font-size: 21px;
}

.expense-summary-list {
  display: grid;
  gap: 9px;
}

.expense-summary-row {
  display: grid;
  grid-template-columns: 40px 1fr auto 44px;
  align-items: center;
  gap: 9px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: #fff;
}

.expense-summary-row.is-over {
  border-color: rgba(197, 76, 52, 0.2);
  background: #fff8f5;
}

.expense-summary-row > em {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  color: var(--primary);
  background: #eef7f4;
  font-style: normal;
}

.expense-summary-row > em svg {
  width: 20px;
  height: 20px;
}

.expense-summary-main,
.expense-summary-money {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.expense-summary-main strong {
  font-size: 13px;
}

.expense-summary-main span,
.expense-summary-money span,
.expense-summary-money small {
  color: var(--muted);
  font-size: 10.5px;
}

.expense-progress {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7e8e6;
}

.expense-progress i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
}

.expense-summary-money {
  text-align: left;
}

.expense-summary-money b {
  color: var(--primary);
  font-size: 12px;
  white-space: nowrap;
}

.expense-summary-row mark {
  min-width: 38px;
  padding: 6px 0;
  border-radius: 12px;
  color: var(--primary);
  background: #eef7f4;
  font-size: 11px;
  font-weight: 800;
  text-align: center;
}

.danger-text {
  color: #b94b35 !important;
}

.tx-card.is-income {
  border-color: rgba(0, 111, 82, 0.14);
  background: #eef9f3;
}

.tx-card.is-expense {
  border-color: rgba(197, 76, 52, 0.14);
  background: #fff5f2;
}

.tx-card.is-investment {
  border-color: rgba(216, 154, 40, 0.2);
  background: #fff7dc;
}

.tx-card.is-loan-payment {
  border-color: rgba(37, 99, 235, 0.16);
  background: #eff6ff;
}

.tx-card > em {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  color: var(--primary);
  background: rgba(255, 255, 255, 0.72);
  font-style: normal;
}

.tx-card.is-expense > em {
  color: #b94b35;
}

.tx-card.is-investment > em {
  color: #b7791f;
}

.tx-card.is-loan-payment > em {
  color: #2563eb;
}

.tx-card > em svg {
  width: 19px;
  height: 19px;
}

.tx-main,
.tx-side {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.tx-main strong {
  font-size: 13px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tx-side {
  text-align: left;
}

.tx-side strong {
  color: var(--primary);
  font-size: 12px;
  white-space: nowrap;
}

.tx-card.is-expense .tx-side strong {
  color: #a9402f;
}

.tx-card.is-investment .tx-side strong {
  color: #9a6700;
}

.tx-card.is-loan-payment .tx-side strong {
  color: #1d4ed8;
}

.tx-side span {
  font-size: 10.5px;
}

.delete {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 13px;
  color: var(--danger);
  background: #fff0ef;
}

.tx-menu-dot {
  color: var(--primary);
  background: rgba(255, 255, 255, 0.8);
}

.delete svg {
  width: 17px;
  height: 17px;
}

.form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

.form input,
.form select,
.form textarea {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 13px;
  outline: 0;
  color: var(--text);
  background: #fbfdfc;
}

.form textarea {
  min-height: 130px;
  resize: vertical;
}

.form input:focus,
.form select:focus,
.form textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(16, 107, 92, 0.12);
}

.m-button {
  min-height: 50px;
  border: 0;
  border-radius: 17px;
  padding: 0 16px;
  color: #fff;
  background: var(--primary);
}

.m-button.ghost {
  color: var(--primary);
  background: #eef7f4;
}

.otp-panel {
  display: grid;
  gap: 5px;
  border: 1px solid #cfe7de;
  border-radius: 16px;
  padding: 12px;
  color: var(--primary-dark);
  background: #eef8f4;
  text-align: center;
}

.otp-panel span {
  direction: ltr;
  font-weight: 900;
}

.otp-panel small {
  color: var(--muted);
  line-height: 1.6;
}

.import-preview-form {
  gap: 12px;
}

.import-preview-item {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fbfdfc;
}

.import-preview-item .wide {
  grid-column: 1 / -1;
}

@media (max-width: 560px) {
  .import-preview-item {
    grid-template-columns: 1fr;
  }

  .import-preview-item .wide {
    grid-column: auto;
  }
}

.danger-button {
  background: var(--danger);
}

.tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}

.tabs button {
  min-height: 42px;
  border: 0;
  border-radius: 15px;
  color: var(--primary);
  background: #eef7f4;
}

.tabs button.active {
  color: #fff;
  background: var(--primary);
}

.soft-note {
  padding: 12px;
  border-radius: 16px;
  background: #eef7f4;
}

.receipt-preview {
  width: 100%;
  max-height: 260px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 16px;
}

.bottom-nav {
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  padding: 7px 10px 16px;
  border: 0;
  border-top: 1px solid #dddddd;
  border-radius: 0;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(14px);
  box-shadow: 0 14px 34px rgba(19, 35, 31, 0.12);
}

.bottom-nav button {
  min-height: 58px;
  display: grid;
  place-items: center;
  gap: 3px;
  padding: 6px;
  background: transparent;
  color: var(--muted);
}

.bottom-nav button.active {
  color: var(--primary);
  background: transparent;
  border-radius: 0;
  font-weight: 700;
  box-shadow: inset 0 3px 0 var(--primary);
}

.bottom-nav svg {
  width: 19px;
  height: 19px;
}

.auth-mobile {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 22px;
}

.auth-mobile .m-card {
  width: min(430px, 100%);
  margin: 0;
}

.auth-hero {
  width: min(430px, 100%);
  margin-bottom: 14px;
  padding: 26px;
  border-radius: 24px;
  color: #fff;
  background: linear-gradient(145deg, var(--primary-dark), var(--primary));
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.app-logo {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 17px;
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
}

.auth-hero .app-logo {
  width: 96px;
  height: 96px;
  border-radius: 26px;
  flex: 0 0 auto;
}

.logo-on-dark {
  background-image: url("/logo-mark-light.svg");
}

.logo-on-light {
  background-image: url("/logo-mark-dark.svg");
}

.auth-hero h1 {
  margin: 0;
  font-size: 38px;
  line-height: 1;
}

.auth-hero p {
  margin: 18px 0 0;
  color: #d8ebe6;
  font-size: 15px;
  line-height: 1.7;
}

.auth-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 14px;
  margin-top: 10px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
}

.auth-links a {
  text-decoration: none;
}

.toast {
  position: fixed;
  inset-inline: 18px;
  bottom: 24px;
  z-index: 50;
  width: min(430px, calc(100% - 36px));
  margin-inline: auto;
  padding: 14px 16px;
  border-radius: 18px;
  color: #fff;
  text-align: center;
  background: var(--primary-dark);
  box-shadow: var(--shadow);
}

.danger {
  color: var(--danger) !important;
}

.ok {
  color: #bff3d9 !important;
}

@media (max-width: 560px) {
  .android-shell {
    display: block;
    padding: 0;
  }

  .android-app {
    width: 100%;
    min-height: 100vh;
    max-height: none;
    border: 0;
    border-radius: 0;
  }

  .m-screen {
    min-height: 100vh;
    max-height: none;
    padding: 18px 14px 98px;
  }

  .spend-card strong {
    font-size: 32px;
  }

  .budget-card {
    grid-template-columns: 1fr 96px 1fr;
    padding: 15px;
  }

  .donut {
    width: 96px;
    height: 96px;
  }

  .budget-side strong {
    font-size: 22px;
  }

  .reference-actions b {
    font-size: 13px;
  }

  .ref-category-row {
    grid-template-columns: 70px 34px 1fr 88px 38px;
    gap: 8px;
  }

  .review-ref-row,
  .last-row {
    grid-template-columns: 78px 80px 1fr 38px;
  }

  .review-ref-row i {
    display: none;
  }

  .review-ref-row p {
    display: none;
  }
}

@media (min-width: 900px) {
  .android-shell::before {
    content: "تصميم أندرويد";
    position: fixed;
    top: 28px;
    right: 34px;
    color: var(--muted);
    font-size: 13px;
  }
}

/* Compact reference pass */
.m-screen {
  padding: 12px 16px 92px;
}

.status-bar {
  height: 24px;
  margin-bottom: 12px;
  font-size: 15px;
}

.home-header {
  margin-bottom: 10px;
}

.home-header button,
.header-icons button {
  width: 38px;
  height: 38px;
}

.home-header svg {
  width: 24px;
  height: 24px;
}

.brand-title {
  font-size: 25px;
}

.greeting {
  margin-bottom: 12px;
}

.greeting h2 {
  font-size: 19px;
}

.greeting p {
  font-size: 13px;
}

.budget-card {
  min-height: 122px;
  padding: 14px;
  border-radius: 16px;
}

.budget-side span,
.budget-side small {
  font-size: 12px;
}

.budget-side strong {
  font-size: 22px;
}

.budget-side .soft {
  font-size: 18px;
}

.budget-side em {
  margin-top: 4px;
  padding: 5px 9px;
  font-size: 11px;
}

.donut {
  width: 98px;
  height: 98px;
}

.donut::before {
  inset: 12px;
}

.donut b {
  font-size: 18px;
  transform: translateY(-6px);
}

.donut span {
  margin-top: 18px;
  font-size: 9.5px;
}

.reference-actions {
  margin: 10px 0;
  border-radius: 16px;
}

.reference-actions button {
  min-height: 58px;
  gap: 8px;
  padding: 7px 9px;
}

.reference-actions span {
  width: 36px;
  height: 36px;
  border-radius: 12px;
}

.reference-actions b {
  font-size: 12.5px;
}

.reference-actions svg {
  width: 20px;
  height: 20px;
}

.ref-card,
.review-ref-card {
  padding: 14px;
  margin-top: 12px;
  border-radius: 16px;
}

.review-ref-head {
  grid-template-columns: 80px 1fr 38px;
  gap: 10px;
  padding-bottom: 11px;
}

.review-ref-head button {
  min-height: 36px;
}

.review-ref-head h3,
.ref-title h3 {
  font-size: 16px;
}

.review-ref-head p {
  font-size: 12px;
}

.review-ref-head > span,
.review-ref-row em,
.last-row em,
.ref-category-row em {
  width: 36px;
  height: 36px;
  border-radius: 12px;
}

.review-ref-row {
  grid-template-columns: 80px 8px 86px 1fr 36px;
  gap: 8px;
  padding-top: 10px;
  font-size: 12px;
}

.ref-title {
  margin-bottom: 8px;
}

.ref-title button {
  font-size: 13px;
}

.ref-category-row {
  grid-template-columns: 66px 34px 1fr 104px 36px;
  gap: 8px;
  min-height: 44px;
}

.ref-category-row strong {
  font-size: 14px;
}

.ref-line {
  height: 6px;
}

.last-row {
  grid-template-columns: 78px 80px 1fr 36px;
  gap: 8px;
  min-height: 48px;
}

.last-row span,
.last-row small {
  font-size: 11px;
}

.last-row strong {
  font-size: 12.5px;
}

.bottom-nav {
  padding: 5px 10px 12px;
}

.bottom-nav button {
  min-height: 50px;
}

.bottom-nav svg {
  width: 17px;
  height: 17px;
}

.bottom-nav span {
  font-size: 11px;
}

@media (max-width: 560px) {
  .budget-card {
    grid-template-columns: 1fr 86px 1fr;
    padding: 12px;
  }

  .donut {
    width: 90px;
    height: 90px;
  }

  .budget-side strong {
    font-size: 19px;
  }

  .reference-actions b {
    font-size: 11.5px;
  }

  .ref-category-row {
    grid-template-columns: 58px 32px 1fr 88px 34px;
    gap: 7px;
  }
}

/* RTL refinement pass */
.home-header {
  grid-template-columns: 40px auto 1fr;
}

.header-icons {
  justify-content: flex-end;
}

.brand-title {
  font-size: 22px;
}

.greeting h2 {
  font-size: 17px;
}

.greeting p {
  font-size: 12px;
}

.budget-side {
  text-align: right;
}

.budget-side.left {
  text-align: center;
  justify-items: center;
}

.budget-side strong {
  font-size: 19px;
}

.budget-side .soft {
  font-size: 16px;
}

.budget-side span,
.budget-side small {
  font-size: 11px;
}

.reference-actions b {
  font-size: 11px;
}

.review-ref-head h3,
.ref-title h3 {
  font-size: 14.5px;
}

.ref-title {
  display: flex;
  flex-direction: row-reverse;
  justify-content: space-between;
  align-items: center;
}

.ref-title h3 {
  text-align: right;
  font-size: 13.5px;
}

.ref-title button {
  margin-inline-start: auto;
  font-size: 12px;
}

.ref-category-row {
  grid-template-columns: 28px 78px 1fr 30px 54px;
  min-height: 38px;
  gap: 7px;
}

.ref-category-row strong {
  font-size: 11.5px;
  text-align: right;
}

.ref-category-row span,
.ref-category-row small {
  font-size: 10.5px;
}

.ref-category-row em {
  width: 31px;
  height: 31px;
  border-radius: 11px;
}

.ref-category-row em svg {
  width: 19px;
  height: 19px;
  stroke-width: 2.4;
}

.ref-title h3 {
  font-size: 13px;
}

.ref-line {
  height: 5px;
}

@media (max-width: 560px) {
  .brand-title {
    font-size: 21px;
  }

  .budget-side strong {
    font-size: 17px;
  }

  .reference-actions b {
    font-size: 10.5px;
  }

  .ref-category-row {
    grid-template-columns: 28px 70px 1fr 28px 48px;
    gap: 6px;
  }

  .ref-category-row strong {
    font-size: 10.8px;
  }

  .ref-category-row span,
  .ref-category-row small {
    font-size: 10px;
  }
}

/* Force category bars to grow from the right */
.ref-line {
  position: relative;
  overflow: hidden;
}

.ref-line i {
  position: absolute;
  top: 0;
  right: 0;
  left: auto;
  margin: 0;
}

/* English LTR layout */
.is-ltr .android-app {
  direction: ltr;
}

.is-ltr .home-header {
  grid-template-columns: 40px auto 1fr;
}

.is-ltr .home-header > button {
  grid-column: 1;
  justify-self: start;
}

.is-ltr .brand-title {
  grid-column: 2;
}

.is-ltr .header-icons {
  grid-column: 3;
  justify-content: flex-end;
  flex-direction: row;
  padding-right: 2px;
}

.is-ltr .greeting,
.is-ltr .budget-side,
.is-ltr .ref-title h3,
.is-ltr .ref-category-row strong,
.is-ltr .last-row div {
  text-align: left;
}

.is-ltr .budget-card {
  direction: ltr;
  grid-template-columns: 1fr 98px 1fr;
}

.is-ltr .budget-side.end {
  order: 3;
  text-align: right;
}

.is-ltr .donut {
  order: 2;
  justify-self: center;
}

.is-ltr .budget-side.left {
  order: 1;
  text-align: center;
}

.is-ltr .reference-actions {
  direction: ltr;
}

.is-ltr .reference-actions button {
  grid-template-columns: 42px 1fr;
  text-align: center;
}

.is-ltr .reference-actions b {
  text-align: center;
  line-height: 1.2;
}

.is-ltr .ref-title {
  flex-direction: row;
}

.is-ltr .ref-title button {
  margin-left: auto;
  margin-inline-start: auto;
  margin-right: 0;
  justify-self: end;
}

.is-ltr .ref-title h3 {
  order: 1;
}

.is-ltr .ref-title button {
  order: 2;
}

.is-ltr .ref-category-row {
  grid-template-columns: 34px 88px 1fr 32px 60px;
}

.is-ltr .ref-line i {
  left: 0;
  right: auto;
}

.is-ltr .last-row {
  grid-template-columns: 36px 1fr 82px 78px;
}

.is-ltr .tx-card {
  direction: ltr;
  grid-template-columns: 38px 1fr auto 34px;
}

.is-ltr .tx-main {
  text-align: left;
}

.is-ltr .tx-side {
  text-align: right;
}

.is-ltr .last-row em {
  grid-column: 1;
}

.is-ltr .last-row div {
  grid-column: 2;
}

.is-ltr .last-row strong {
  grid-column: 3;
}

.is-ltr .last-row > span {
  grid-column: 4;
}

@media (max-width: 560px) {
  .is-ltr .home-header {
    grid-template-columns: 36px auto 1fr;
  }

  .is-ltr .budget-card {
    grid-template-columns: 1fr 90px 1fr;
  }

  .is-ltr .ref-category-row {
    grid-template-columns: 30px 72px 1fr 28px 54px;
  }

  .is-ltr .last-row {
    grid-template-columns: 34px 1fr 70px 66px;
  }
}

/* Tighter cards pass */
.ref-card {
  padding-top: 10px;
  padding-bottom: 10px;
}

.ref-title {
  margin-bottom: 5px;
}

.ref-category-row {
  min-height: 35px;
}

.last-row {
  min-height: 42px;
}

.ref-card .empty {
  padding: 8px 0;
}

/* Real Android device polish */
@media (max-width: 560px) {
  html,
  body,
  #app,
  .android-shell,
  .android-app {
    min-height: 100dvh;
    background: #fff;
  }

  .status-bar {
    display: none;
  }

  .m-screen {
    min-height: 100dvh;
    padding: 16px 15px 120px;
  }

  .home-header {
    margin-top: 2px;
    margin-bottom: 9px;
  }

  .home-header button,
  .header-icons button {
    width: 36px;
    height: 36px;
  }

  .home-header svg {
    width: 22px;
    height: 22px;
  }

  .brand-title {
    font-size: 20px;
  }

  .greeting {
    margin-bottom: 10px;
  }

  .greeting h2 {
    font-size: 16px;
    line-height: 1.25;
  }

  .greeting p {
    font-size: 11.5px;
  }

  .budget-card {
    min-height: 118px;
    padding: 12px;
    grid-template-columns: 1fr 92px 1fr;
  }

  .donut {
    width: 92px;
    height: 92px;
  }

  .donut::before {
    inset: 13px;
  }

  .donut b {
    font-size: 17px;
  }

  .donut span {
    font-size: 9px;
  }

  .budget-side span,
  .budget-side small {
    font-size: 10.5px;
  }

  .budget-side strong {
    font-size: 17px;
  }

  .budget-side .soft {
    font-size: 15px;
  }

  .reference-actions {
    margin: 9px 0;
  }

  .reference-actions button {
    min-height: 54px;
    padding: 6px 7px;
    gap: 6px;
  }

  .reference-actions span {
    width: 34px;
    height: 34px;
  }

  .reference-actions b {
    font-size: 10.2px;
    line-height: 1.25;
  }

  .ref-card {
    margin-top: 10px;
    padding: 10px 11px;
  }

  .ref-title h3 {
    font-size: 12.5px;
  }

  .ref-title button {
    font-size: 11.5px;
  }

  .ref-category-row {
    grid-template-columns: 30px 62px 1fr 28px 46px;
    min-height: 34px;
    gap: 5px;
  }

  .ref-category-row strong {
    font-size: 10.4px;
    line-height: 1.1;
    white-space: nowrap;
  }

  .ref-category-row span,
  .ref-category-row small {
    font-size: 9.8px;
  }

  .ref-category-row em,
  .last-row em,
  .review-ref-head > span,
  .review-ref-row em {
    width: 30px;
    height: 30px;
    border-radius: 10px;
  }

  .ref-category-row em svg,
  .last-row em svg {
    width: 18px;
    height: 18px;
  }

  .bottom-nav {
    bottom: 0;
    min-height: 64px;
    padding: 4px 10px 8px;
    border-top: 1px solid rgba(0, 95, 75, 0.12);
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(12px);
  }

  .bottom-nav button {
    min-height: 48px;
    align-content: center;
  }

  .bottom-nav svg {
    width: 18px;
    height: 18px;
  }

  .bottom-nav span {
    font-size: 10.8px;
    line-height: 1.1;
    color: inherit;
  }

  .is-ltr .ref-category-row {
    grid-template-columns: 30px 70px 1fr 28px 52px;
  }
}

.last-row {
  grid-template-columns: 62px minmax(0, 1fr) 82px 30px;
  gap: 8px;
  min-height: 40px;
}

.last-row button {
  width: 30px;
  height: 30px;
}

.last-row button svg {
  width: 17px;
  height: 17px;
}

.is-ltr .last-row {
  grid-template-columns: 62px minmax(0, 1fr) 82px 30px;
}

.is-ltr .last-row > span,
.is-ltr .last-row div,
.is-ltr .last-row strong {
  grid-column: auto;
}

.is-ltr .last-row div {
  text-align: left;
}

@media (max-width: 420px) {
  .last-row {
    grid-template-columns: 52px minmax(0, 1fr) 72px 28px;
    gap: 6px;
  }

  .last-row span,
  .last-row strong,
  .last-row b {
    font-size: 10.5px;
  }
}

/* Keep app chrome fixed while only the page body scrolls. */
.android-app {
  height: min(920px, calc(100vh - 48px));
  min-height: 0;
  overflow: hidden;
}

.m-screen {
  height: 100%;
  max-height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.app-topbar {
  position: sticky;
  top: 0;
  z-index: 24;
  margin-inline: -2px;
  padding: 6px 2px 8px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(14px);
}

.bottom-nav {
  position: absolute;
  z-index: 25;
}

@media (max-width: 560px) {
  .android-shell {
    min-height: 100dvh;
    padding: 0;
  }

  .android-app {
    height: 100dvh !important;
    min-height: 100dvh !important;
    max-height: 100dvh !important;
  }

  .m-screen {
    height: 100dvh !important;
    min-height: 0 !important;
    max-height: 100dvh !important;
    padding-bottom: 96px !important;
  }
}

/* v59: keep the top chrome pinned from the first pixel and hide scrolled content behind it. */
.m-screen {
  padding-top: 0 !important;
  background: var(--app);
}

.app-topbar {
  position: sticky;
  top: 0;
  z-index: 80;
  margin-inline: -18px !important;
  margin-bottom: 12px;
  padding: 14px 18px 10px !important;
  background: var(--app) !important;
  border-bottom: 1px solid rgba(0, 95, 75, 0.08);
  box-shadow: 0 8px 18px rgba(255, 255, 255, 0.96);
}

.app-topbar::before {
  content: "";
  position: absolute;
  inset-inline: 0;
  top: -90px;
  height: 90px;
  background: var(--app);
}

.ref-category-row em,
.expense-summary-row > em,
.select-with-icon em,
.budget-item-row em,
.gold-icon {
  color: var(--primary) !important;
  background: #eef6f1 !important;
}

.tx-menu-spacer {
  width: 34px;
  height: 34px;
}

.tx-card.is-investment {
  border-color: rgba(216, 154, 40, 0.22);
  background: #fff8df;
}

.tx-card.is-loan-payment {
  border-color: rgba(37, 99, 235, 0.18);
  background: #eef6ff;
}
