/* =====================================================================
 * $honchoy COMPONENTS (reusable classes, built only from tokens.css)
 * ---------------------------------------------------------------------
 *  Layout   .container .stack .row .grid-2 .grid-3 .screen-head
 *  Surface  .card .card--soft .card--brand
 *  Action   .btn .btn--primary .btn--secondary .btn--ghost .btn--sm .btn--block .icon-btn
 *  Form     .field .label .input .select .choice-grid .choice .check .slider .segmented
 *  Data     .progress(.progress--goals/--success) .stat .pill .alert(--warn/--danger/--success/--info) .list-item
 *  Brand    .logo .lang-toggle
 * ===================================================================== */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--color-bg); color: var(--color-text);
  font-family: var(--font-body); font-size: var(--text-md); line-height: var(--leading-body);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: var(--font-display); line-height: var(--leading-tight); margin: 0; color: var(--color-text); }
h1 { font-size: var(--text-2xl); font-weight: var(--weight-bold); }
h2 { font-size: var(--text-xl); font-weight: var(--weight-bold); }
h3 { font-size: var(--text-lg); font-weight: var(--weight-semibold); }
p { margin: 0; }
a { color: var(--color-primary-strong); }
img, svg { max-width: 100%; }
:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: var(--radius-sm); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--color-muted); }
.text-sm { font-size: var(--text-sm); } .text-xs { font-size: var(--text-xs); }
.text-strong { font-weight: var(--weight-semibold); }
.num { font-variant-numeric: tabular-nums; }

/* ---------- Layout ---------- */
.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 var(--space-4); }
.container--narrow { max-width: var(--container-narrow); }
.stack > * + * { margin-top: var(--space-4); }
.stack-sm > * + * { margin-top: var(--space-2); }
.stack-lg > * + * { margin-top: var(--space-6); }
.row { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.row--between { justify-content: space-between; }
.grid-2, .grid-3 { display: grid; gap: var(--space-4); grid-template-columns: 1fr; }
@media (min-width: 720px) { .grid-2 { grid-template-columns: 1fr 1fr; } .grid-3 { grid-template-columns: repeat(3, 1fr); } }
.screen-head { padding: var(--space-6) 0 var(--space-4); }
.screen-head p { color: var(--color-text-2); margin-top: var(--space-1); }

/* ---------- Card ---------- */
.card {
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius-lg); padding: var(--space-5); box-shadow: var(--shadow-md);
}
.card--soft { background: var(--gradient-soft); }
.card--brand { background: var(--gradient-brand); color: var(--white); border: 0; box-shadow: var(--shadow-lg); }
.card--brand h1, .card--brand h2, .card--brand h3 { color: var(--white); }
.card__head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--space-3); margin-bottom: var(--space-4); }
.card__head p { color: var(--color-muted); font-size: var(--text-sm); margin-top: 2px; }
@media (max-width: 480px) { .card { padding: var(--space-4); border-radius: var(--radius-md); } }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: var(--tap-min); padding: 0 var(--space-5); border-radius: var(--radius-pill);
  border: 1.5px solid transparent; font: inherit; font-weight: var(--weight-semibold);
  cursor: pointer; transition: transform var(--dur-fast) var(--ease), background var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
  text-decoration: none; white-space: nowrap;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn--primary { background: var(--color-primary); color: var(--color-on-primary); box-shadow: 0 6px 16px rgba(232, 79, 130, .3); }
.btn--primary:hover:not(:disabled) { background: var(--color-primary-strong); }
.btn--secondary { background: var(--color-primary-soft); color: var(--rose-700); }
.btn--secondary:hover { background: var(--rose-200); }
.btn--ghost { background: transparent; color: var(--color-primary-strong); border-color: var(--rose-200); }
.btn--ghost:hover { background: var(--rose-50); }
.btn--danger { background: var(--color-danger-soft); color: var(--color-danger); }
.btn--sm { min-height: 36px; padding: 0 var(--space-3); font-size: var(--text-sm); }
.btn--block { width: 100%; }
.icon-btn {
  width: var(--tap-min); height: var(--tap-min); display: inline-grid; place-items: center; flex: none;
  border-radius: var(--radius-pill); border: 0; background: transparent; color: var(--color-muted); cursor: pointer; font-size: 1rem;
}
.icon-btn:hover { background: var(--color-danger-soft); color: var(--color-danger); }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.label { font-size: var(--text-sm); font-weight: var(--weight-semibold); color: var(--color-text-2); }
.input, .select {
  width: 100%; min-height: var(--tap-min); padding: 10px 14px; font: inherit; font-size: var(--text-md);
  color: var(--color-text); background: var(--color-surface-2);
  border: 1.5px solid var(--color-border); border-radius: var(--radius-md); transition: border-color var(--dur);
}
.input::placeholder { color: #b89aae; }
.input:focus, .select:focus { outline: none; border-color: var(--color-primary); box-shadow: var(--focus-ring); }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%238a6180' stroke-width='2'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; }
.form-grid { display: grid; gap: var(--space-3); grid-template-columns: 1fr; }
@media (min-width: 600px) { .form-grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); align-items: end; } }

/* Big selectable cards (income type etc.) */
.choice-grid { display: grid; gap: var(--space-3); grid-template-columns: 1fr; }
@media (min-width: 520px) { .choice-grid { grid-template-columns: repeat(3, 1fr); } }
.choice { position: relative; cursor: pointer; }
.choice input { position: absolute; opacity: 0; }
.choice__body {
  display: flex; gap: var(--space-3); align-items: center; height: 100%;
  padding: var(--space-4); border: 1.5px solid var(--color-border); border-radius: var(--radius-md);
  background: var(--color-surface-2); transition: all var(--dur) var(--ease);
}
@media (min-width: 520px) { .choice__body { flex-direction: column; text-align: center; } }
.choice__icon { width: 40px; height: 40px; flex: none; border-radius: var(--radius-pill); display: grid; place-items: center; background: var(--color-primary-soft); color: var(--color-primary-strong); }
.choice__title { font-weight: var(--weight-semibold); display: block; }
.choice__hint { font-size: var(--text-xs); color: var(--color-muted); display: block; }
.choice input:checked + .choice__body { border-color: var(--color-primary); background: var(--rose-50); box-shadow: var(--focus-ring); }
.choice input:checked + .choice__body .choice__icon { background: var(--color-primary); color: var(--white); }
.choice input:focus-visible + .choice__body { box-shadow: var(--focus-ring); }

/* Checkbox (age gate, scam checker) */
.check { display: flex; gap: var(--space-3); align-items: flex-start; cursor: pointer; padding: var(--space-3) var(--space-4);
  border: 1.5px solid var(--color-border); border-radius: var(--radius-md); background: var(--color-surface-2); transition: all var(--dur); }
.check:hover { border-color: var(--rose-300); }
.check input { appearance: none; flex: none; width: 24px; height: 24px; margin: 1px 0 0; border-radius: 7px;
  border: 2px solid var(--rose-300); background: var(--white); display: grid; place-items: center; cursor: pointer; transition: all var(--dur-fast); }
.check input::after { content: ''; width: 12px; height: 7px; border: 3px solid var(--white); border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px) scale(0); transition: transform var(--dur-fast); }
.check input:checked { background: var(--color-primary); border-color: var(--color-primary); }
.check input:checked::after { transform: rotate(-45deg) translate(1px, -1px) scale(1); }
.check:has(input:checked) { border-color: var(--color-primary); background: var(--rose-50); }
.check--danger:has(input:checked) { border-color: var(--color-danger); background: var(--color-danger-soft); }
.check--danger input:checked { background: var(--color-danger); border-color: var(--color-danger); }

/* Segmented control (fixed/variable etc.) */
.segmented { display: inline-flex; padding: 4px; background: var(--color-primary-soft); border-radius: var(--radius-pill); gap: 2px; }
.segmented button { min-height: 36px; padding: 0 var(--space-4); border: 0; border-radius: var(--radius-pill); background: transparent;
  font: inherit; font-size: var(--text-sm); font-weight: var(--weight-semibold); color: var(--rose-700); cursor: pointer; }
.segmented button.is-active { background: var(--white); color: var(--color-primary-strong); box-shadow: var(--shadow-sm); }

/* Range slider */
.slider { -webkit-appearance: none; appearance: none; width: 100%; height: 8px; border-radius: var(--radius-pill); cursor: pointer;
  background: linear-gradient(to right, var(--color-primary) var(--fill, 50%), var(--rose-200) var(--fill, 50%)); }
.slider::-webkit-slider-thumb { -webkit-appearance: none; width: 26px; height: 26px; border-radius: 50%; background: var(--white);
  border: 3px solid var(--color-primary); box-shadow: var(--shadow-md); }
.slider::-moz-range-thumb { width: 22px; height: 22px; border-radius: 50%; background: var(--white); border: 3px solid var(--color-primary); }

/* ---------- Progress bar ---------- */
.progress { height: 12px; background: var(--rose-100); border-radius: var(--radius-pill); overflow: hidden; }
.progress__bar { height: 100%; width: 0; border-radius: inherit; background: var(--gradient-brand); transition: width var(--dur-slow) var(--ease); }
.progress--goals .progress__bar { background: linear-gradient(90deg, #c49bf0, var(--color-goals)); }
.progress--success .progress__bar { background: linear-gradient(90deg, #7bd3b0, var(--color-success)); }
.progress--sm { height: 8px; }
.progress-meta { display: flex; justify-content: space-between; font-size: var(--text-sm); color: var(--color-text-2); margin-top: 6px; gap: var(--space-2); }

/* ---------- Data display ---------- */
.stat__label { font-size: var(--text-xs); text-transform: uppercase; letter-spacing: .04em; color: var(--color-muted); font-weight: var(--weight-semibold); }
:lang(bn) .stat__label { text-transform: none; letter-spacing: 0; font-size: var(--text-sm); }
.stat__value { font-family: var(--font-display); font-size: var(--text-xl); font-weight: var(--weight-bold); font-variant-numeric: tabular-nums; }
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: var(--radius-pill); font-size: var(--text-xs);
  font-weight: var(--weight-semibold); background: var(--color-primary-soft); color: var(--rose-700); white-space: nowrap; }
.pill--fixed { background: var(--color-info-soft); color: var(--color-info); }
.pill--danger { background: var(--color-danger-soft); color: var(--color-danger); }
.pill--success { background: var(--color-success-soft); color: var(--color-success); }

.alert { display: flex; gap: var(--space-3); align-items: flex-start; padding: var(--space-3) var(--space-4); border-radius: var(--radius-md);
  font-size: var(--text-sm); background: var(--color-info-soft); color: var(--color-info); }
.alert i { margin-top: 3px; }
.alert--warn { background: var(--color-warning-soft); color: var(--color-warning); }
.alert--danger { background: var(--color-danger-soft); color: var(--color-danger); }
.alert--success { background: var(--color-success-soft); color: var(--color-success); }

.list { list-style: none; margin: 0; padding: 0; }
.list-item { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) 0; border-top: 1px solid var(--color-border); }
.list-item:first-child { border-top: 0; }
.list-item__main { flex: 1; min-width: 0; }
.list-item__title { font-weight: var(--weight-semibold); overflow-wrap: anywhere; }
.list-item__meta { font-size: var(--text-xs); color: var(--color-muted); display: flex; gap: var(--space-2); flex-wrap: wrap; align-items: center; }
.list-item__amount { font-weight: var(--weight-bold); font-variant-numeric: tabular-nums; white-space: nowrap; }
.empty { text-align: center; color: var(--color-muted); padding: var(--space-6) var(--space-4); font-size: var(--text-sm); }

/* ---------- Brand ---------- */
.logo { display: inline-flex; align-items: center; gap: var(--space-2); text-decoration: none; color: var(--color-text); }
.logo img { width: 36px; height: 36px; }
.logo__word { font-family: var(--font-display); font-weight: var(--weight-bold); font-size: 1.35rem; letter-spacing: -.01em; }
.logo__word b { color: var(--color-primary); }

.lang-toggle { display: inline-flex; padding: 3px; border-radius: var(--radius-pill); background: var(--white); border: 1px solid var(--color-border); }
.lang-toggle button { min-width: 44px; min-height: 34px; border: 0; background: transparent; border-radius: var(--radius-pill);
  font: inherit; font-size: var(--text-sm); font-weight: var(--weight-semibold); color: var(--color-muted); cursor: pointer; transition: all var(--dur); }
.lang-toggle button.is-active { background: var(--color-primary); color: var(--white); }
