:root {
  color-scheme: light;
  --bg: #f4f2f7;
  --surface: #ffffff;
  --surface-soft: #f7f6fb;
  --text: #090909;
  --muted: #777782;
  --line: #e7e5eb;
  --black: #030303;
  --shadow: 0 28px 80px rgba(25, 22, 32, 0.12);
  --state: #0f8a4a;
  --state-soft: rgba(15, 138, 74, 0.11);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  background: var(--bg);
}

body {
  min-width: min(320px, 100%);
  min-height: 100svh;
  margin: 0;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0) 420px),
    var(--bg);
  color: var(--text);
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

svg {
  display: block;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app-shell {
  width: min(100%, 430px);
  min-height: 100svh;
  margin: 0 auto;
  display: grid;
  grid-template-rows: auto 100px minmax(0, 1fr);
  background: var(--black);
  box-shadow: 0 34px 90px rgba(18, 18, 22, 0.12);
}

.hero-card {
  position: relative;
  z-index: 2;
  display: grid;
  align-content: start;
  justify-items: start;
  min-width: 0;
  min-height: 464px;
  padding: max(34px, env(safe-area-inset-top)) 34px 20px;
  border-radius: 0 0 32px 32px;
  background:
    radial-gradient(circle at 78% 18%, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0) 170px),
    linear-gradient(145deg, #fbfbff 0%, #eeeef8 100%);
  transition:
    min-height 260ms ease,
    border-radius 260ms ease;
}

.hero-card::after {
  content: "";
  position: absolute;
  inset: auto 24px 0;
  height: 1px;
  background: rgba(255, 255, 255, 0.6);
}

.eyebrow,
.section-kicker,
label span,
dt {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0;
}

.eyebrow {
  color: #090909;
  font-size: 1.42rem;
  font-weight: 820;
  line-height: 1.08;
}

h1,
h2,
h3 {
  margin: 0;
  color: var(--text);
  letter-spacing: 0;
}

h1 {
  margin-top: 6px;
  color: #747480;
  font-size: 0.94rem;
  font-weight: 720;
}

.currency-pill {
  justify-self: center;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 28px;
  padding: 4px 9px 4px 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: inset 0 0 0 1px rgba(225, 224, 233, 0.72);
  color: #777782;
  font-size: 0.83rem;
}

.currency-pill span {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 50%;
  color: #ffffff;
  background: #050505;
  font-weight: 800;
}

.currency-pill strong {
  font-weight: 760;
}

.main-balance {
  justify-self: center;
  margin: 18px 0 0;
  color: #030303;
  font-size: clamp(2.95rem, 12.7vw, 3.72rem);
  font-weight: 840;
  line-height: 0.96;
  letter-spacing: 0;
  white-space: nowrap;
}

.balance-caption {
  justify-self: center;
  margin: 8px 0 0;
  color: #73737d;
  font-size: 0.9rem;
  font-weight: 780;
}

.hero-history {
  width: 100%;
  min-width: 0;
  margin-top: 34px;
  padding-top: 18px;
  border-top: 1px solid rgba(219, 217, 226, 0.72);
}

.hero-history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.hero-history-head p,
.hero-history-head span {
  margin: 0;
  color: #747480;
  font-size: 0.72rem;
  font-weight: 760;
  text-transform: uppercase;
}

.hero-view-all {
  border: 0;
  padding: 0;
  color: #777782;
  background: transparent;
  font-size: 0.76rem;
  font-weight: 760;
}

.hero-card.expanded .hero-view-all {
  display: none;
}

.hero-history-list {
  display: grid;
  gap: 0;
  margin-top: 16px;
}

.hero-history-empty {
  margin: 0;
  color: #7e7d86;
  font-size: 0.84rem;
  font-weight: 680;
}

.hero-transaction {
  display: grid;
  grid-template-columns: 24px minmax(84px, auto) minmax(0, 1fr) 16px;
  column-gap: 12px;
  row-gap: 3px;
  align-items: center;
  min-width: 0;
  padding: 13px 0;
  border-bottom: 1px solid rgba(219, 217, 226, 0.78);
  opacity: 0.78;
}

.hero-transaction:nth-child(1) {
  opacity: 1;
}

.hero-transaction:nth-child(2) {
  opacity: 0.88;
}

.hero-transaction:nth-child(3) {
  opacity: 0.76;
}

.hero-transaction:last-child {
  border-bottom: 0;
}

.hero-indicator {
  display: grid;
  width: 16px;
  height: 16px;
  place-items: center;
  border-radius: 50%;
  background: rgba(197, 64, 47, 0.1);
}

.hero-indicator::after {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #c5402f;
}

.hero-transaction.income .hero-indicator {
  background: rgba(15, 138, 74, 0.12);
}

.hero-transaction.income .hero-indicator::after {
  background: #0f8a4a;
}

.hero-transaction strong {
  color: #c5402f;
  font-size: 0.91rem;
  font-weight: 820;
  white-space: nowrap;
}

.hero-transaction.income strong {
  color: #0f8a4a;
}

.hero-transaction p {
  margin: 0;
  overflow: hidden;
  color: #2b2b31;
  font-size: 0.92rem;
  font-weight: 790;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hero-transaction small {
  grid-column: 3;
  overflow: hidden;
  color: #777782;
  font-size: 0.76rem;
  font-weight: 720;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hero-chevron {
  grid-column: 4;
  grid-row: 1 / span 2;
  width: 9px;
  height: 9px;
  border-top: 2px solid #8c8b94;
  border-right: 2px solid #8c8b94;
  transform: rotate(45deg);
}

.hero-expand-button {
  justify-self: center;
  display: grid;
  width: 44px;
  height: 18px;
  place-items: center;
  margin-top: 4px;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.hero-expand-button span {
  width: 28px;
  height: 3px;
  border-radius: 999px;
  background: #a5a3ac;
}

.hero-card.expanded {
  min-height: min(72svh, 640px);
  align-content: start;
}

.hero-card.expanded .hero-history {
  margin-top: 26px;
}

.hero-card.expanded .hero-history-list {
  max-height: min(34svh, 280px);
  overflow-y: auto;
  padding-right: 4px;
}

.hero-card.expanded .hero-transaction {
  grid-template-columns: 34px minmax(86px, auto) minmax(0, 1fr) 16px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(214, 213, 222, 0.72);
  font-size: 1em;
  opacity: 1;
}

.hero-card.expanded .hero-transaction:last-child {
  border-bottom: 0;
}

.hero-card.expanded .hero-transaction p {
  white-space: normal;
}

.hero-card.expanded .hero-transaction small {
  white-space: normal;
}

.hero-card.expanded .hero-indicator {
  width: 30px;
  height: 30px;
}

.hero-card.expanded .hero-indicator::after {
  width: 12px;
  height: 12px;
}

.voice-dock {
  position: relative;
  display: grid;
  place-items: center;
  margin-top: -1px;
  background: var(--black);
}

.mic-cluster {
  display: grid;
  justify-items: center;
  gap: 5px;
  transform: translateY(-8px);
}

.mic-cluster > span {
  color: rgba(255, 255, 255, 0.68);
  font-size: 0.72rem;
  font-weight: 720;
}

.mic-button {
  position: relative;
  z-index: 4;
  display: grid;
  width: 82px;
  height: 82px;
  place-items: center;
  border: 10px solid var(--black);
  border-radius: 28px;
  color: #0a0a0a;
  background:
    radial-gradient(circle at 50% 12%, rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0) 54px),
    linear-gradient(145deg, #fbfbff, #eeeef8);
  box-shadow:
    0 16px 34px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.88);
  transition:
    transform 180ms ease,
    box-shadow 180ms ease;
}

.mic-button:hover {
  transform: translateY(-1px);
}

.mic-button:active {
  transform: scale(0.98);
}

.mic-icon {
  position: relative;
  z-index: 2;
  width: 36px;
  height: 36px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.65;
}

.mic-ripple {
  position: absolute;
  inset: 6px;
  border-radius: 28px;
  opacity: 0;
}

.mic-button.listening .mic-ripple {
  animation: voice-pulse 1.55s ease-out infinite;
  background: rgba(15, 138, 74, 0.18);
}

.mic-button.processing .mic-ripple {
  inset: -9px;
  opacity: 1;
  border: 2px solid rgba(255, 255, 255, 0.42);
  border-top-color: rgba(15, 138, 74, 0.95);
  animation: voice-spin 1s linear infinite;
}

.allowance-card {
  position: relative;
  z-index: 3;
  display: grid;
  align-content: start;
  gap: 14px;
  margin-top: -1px;
  padding: 26px 28px max(14px, env(safe-area-inset-bottom));
  border-radius: 32px 32px 0 0;
  background: #ffffff;
}

.allowance-card > h2 {
  font-size: 1.38rem;
  font-weight: 780;
}

.money-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.money-row div {
  min-width: 0;
}

.money-row > div > span {
  display: block;
  color: #6f717a;
  font-size: 0.93rem;
  font-weight: 700;
}

#days-left {
  display: inline;
}

.money-row strong {
  display: block;
  margin-top: 8px;
  font-size: 1.82rem;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.money-row small {
  display: block;
  margin-top: 6px;
  color: #6f717a;
  font-size: 0.9rem;
  font-weight: 740;
}

.money-divider {
  height: 1px;
  background: var(--line);
}

.protection-summary {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.protection-summary h3 {
  color: #111114;
  font-size: 0.92rem;
  font-weight: 790;
}

.protection-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 18px;
  margin: 0;
}

.protection-stat {
  min-width: 0;
}

.protection-stat dt {
  color: #74747e;
  font-size: 0.76rem;
  font-weight: 700;
}

.protection-stat dd {
  margin: 4px 0 0;
  color: #151519;
  font-size: 1.02rem;
  font-weight: 810;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.protection-result {
  grid-column: 1 / -1;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding-top: 9px;
  border-top: 1px solid var(--line);
}

.protection-result dd {
  color: var(--state);
}

.distribution-trigger {
  display: flex;
  width: 100%;
  min-height: 44px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0;
  border: 0;
  border-top: 1px solid var(--line);
  color: #252529;
  background: transparent;
  font-size: 0.86rem;
  font-weight: 760;
  text-align: left;
}

.distribution-trigger span:last-child {
  color: var(--state);
  font-size: 1.45rem;
  line-height: 1;
}

.distribution-trigger:active {
  opacity: 0.65;
}

.distribution-trigger:focus-visible {
  outline: 2px solid var(--state);
  outline-offset: 3px;
  border-radius: 4px;
}
.row-icon {
  display: grid;
  flex: 0 0 54px;
  width: 54px;
  height: 54px;
  place-items: center;
  border-radius: 50%;
  background: var(--state-soft);
}

.row-icon svg {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.status-card {
  margin-top: 4px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 14px 40px rgba(20, 20, 24, 0.04);
}

.status-card h2 {
  font-size: 1.18rem;
  font-weight: 780;
}

.status-content {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr) 44px;
  align-items: center;
  gap: 14px;
  margin-top: 15px;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--state);
  box-shadow: 0 0 0 6px var(--state-soft);
}

.state-color {
  color: var(--state);
}

.status-content strong {
  display: block;
  font-size: 1.44rem;
  font-weight: 820;
  line-height: 1;
  text-transform: uppercase;
}

.status-content p {
  margin: 6px 0 0;
  color: #6f717a;
  font-size: 0.92rem;
  font-weight: 650;
}

.status-icon-button,
.icon-button {
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
}

.status-icon-button {
  width: 44px;
  min-width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--state-soft);
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.status-icon-button:active {
  transform: scale(0.94);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06);
}

.status-icon-button:focus-visible {
  outline: 2px solid var(--state);
  outline-offset: 3px;
}

.status-icon-button svg,
.icon-button svg {
  width: 25px;
  height: 25px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.flow-panel,
.secondary-screen {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: end center;
  padding: 16px;
  background: rgba(7, 7, 8, 0.34);
  backdrop-filter: blur(14px);
}

.flow-card,
.secondary-card {
  width: min(100%, 430px);
  max-height: calc(100svh - 32px);
  overflow-y: auto;
  border: 1px solid rgba(232, 229, 235, 0.9);
  border-radius: 30px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: var(--shadow);
}

.flow-card {
  position: relative;
  display: grid;
  gap: 16px;
  padding: 28px 18px 18px;
}

.protection-distribution-panel {
  position: fixed;
  inset: 0;
  z-index: 31;
  display: grid;
  place-items: end center;
  padding: 16px;
  background: rgba(7, 7, 8, 0.34);
  backdrop-filter: blur(14px);
}

.protection-distribution-card {
  width: min(100%, 430px);
  max-height: calc(100svh - 32px);
  overflow-y: auto;
  padding: 18px;
  border: 1px solid rgba(232, 229, 235, 0.9);
  border-radius: 30px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: var(--shadow);
}

.protection-distribution-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.protection-distribution-header h2 {
  max-width: 280px;
  margin-top: 4px;
  font-size: 1.22rem;
  line-height: 1.15;
}

.protection-distribution-close {
  width: 44px;
  min-width: 44px;
  height: 44px;
  border-radius: 50%;
  color: #222226;
  background: #f5f4f8;
}

.protection-distribution-content {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.distribution-totals {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 11px 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
}

.distribution-totals div {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.distribution-totals span,
.distribution-obligation > span {
  color: #6f717a;
  font-size: 0.78rem;
  font-weight: 680;
}

.distribution-totals strong {
  color: #17171b;
  font-size: 1rem;
  overflow-wrap: anywhere;
}

.distribution-totals .distribution-result {
  grid-column: 1 / -1;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding-top: 9px;
  border-top: 1px solid var(--line);
}

.distribution-totals .distribution-result strong {
  color: var(--state);
}

.distribution-explanation {
  margin: 0;
  color: #55555e;
  font-size: 0.88rem;
  font-weight: 650;
  line-height: 1.48;
}

.distribution-list-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding-top: 3px;
}

.distribution-list-head h3,
.distribution-list-head strong {
  font-size: 0.9rem;
}

.distribution-obligations {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line);
}

.distribution-obligation {
  display: grid;
  gap: 5px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}

.distribution-obligation-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.distribution-obligation-head > strong {
  min-width: 0;
  font-size: 0.92rem;
  overflow-wrap: anywhere;
}

.distribution-obligation-head > span {
  flex: 0 0 auto;
  color: #17171b;
  font-size: 0.92rem;
  font-weight: 810;
}

.distribution-obligation.at-risk .distribution-obligation-head > strong,
.distribution-obligation.at-risk .distribution-shortfall,
.distribution-obligation.at-risk .distribution-shortfall strong {
  color: var(--state);
}

.distribution-empty {
  padding: 16px 0;
  color: #74747e;
  font-size: 0.86rem;
}
.state-explanation-panel {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: end center;
  padding: 16px;
  background: rgba(7, 7, 8, 0.34);
  backdrop-filter: blur(14px);
}

.state-explanation-card {
  width: min(100%, 430px);
  max-height: calc(100svh - 32px);
  overflow-y: auto;
  border: 1px solid rgba(232, 229, 235, 0.9);
  border-radius: 30px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: var(--shadow);
  padding: 18px;
}

.state-explanation-header,
.explanation-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.state-explanation-header h2 {
  margin-top: 4px;
  font-size: 1.24rem;
  line-height: 1.1;
}

.state-explanation-close {
  width: 44px;
  min-width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #f5f4f8;
  color: #222226;
}

.state-explanation-content {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.explanation-status-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px;
  border-radius: 18px;
  background: var(--state-soft);
}

.explanation-status-row span,
.explanation-period,
.explanation-block p,
.explanation-improve p,
.protected-breakdown small,
.factor-list,
.explanation-improve small {
  color: #6f717a;
  font-size: 0.9rem;
  font-weight: 650;
}

.explanation-status-row strong {
  display: block;
  margin-top: 2px;
  font-size: 1.15rem;
  text-transform: uppercase;
}

.explanation-icon {
  display: grid;
  place-items: center;
  width: 44px;
  min-width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.82);
}

.explanation-icon svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.2;
}

.explanation-period {
  margin: 0;
}

.explanation-block,
.explanation-improve {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.72);
}

.explanation-block h3,
.explanation-improve h3 {
  margin: 0 0 8px;
  color: #111114;
  font-size: 0.96rem;
}

.explanation-block > strong {
  display: block;
  margin-bottom: 7px;
  font-size: 1.02rem;
}

.explanation-block p,
.explanation-improve p {
  margin: 0;
  line-height: 1.45;
}

.explanation-numbers {
  display: grid;
  gap: 8px;
  margin: 0;
}

.explanation-numbers div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 12px;
  border-radius: 15px;
  background: #f7f6fa;
}

.explanation-numbers dt {
  color: #6f717a;
  font-size: 0.86rem;
  font-weight: 720;
}

.explanation-numbers dd {
  margin: 0;
  color: #151518;
  font-weight: 820;
}

.explanation-numbers .danger dd {
  color: #c5402f;
}

.protected-breakdown,
.factor-list {
  display: grid;
  gap: 0;
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
}

.protected-breakdown li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 0;
  border-top: 1px solid var(--line);
}

.protected-breakdown span,
.protected-breakdown small {
  display: block;
}

.protected-breakdown span {
  color: #17171a;
  font-weight: 760;
}

.protected-breakdown strong,
.explanation-section-head strong {
  color: #151518;
  font-weight: 820;
}

.factor-list li {
  padding: 8px 0;
  border-top: 1px solid var(--line);
  line-height: 1.35;
}

.explanation-improve {
  background: var(--state-soft);
  border-color: transparent;
}

.explanation-improve small {
  display: block;
  margin-top: 8px;
}

.explanation-close-action {
  width: 100%;
  min-height: 44px;
}

.flow-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  color: #2d2d32;
  background: #f5f4f8;
}

.listening-visual {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  min-height: 50px;
  margin-top: 10px;
}

.listening-visual span {
  width: 10px;
  height: 28px;
  border-radius: 999px;
  background: var(--state);
  transform-origin: center;
  animation: voice-wave 1s ease-in-out infinite;
}

.listening-visual span:nth-child(2) {
  animation-delay: 130ms;
}

.listening-visual span:nth-child(3) {
  animation-delay: 260ms;
}

.voice-status {
  margin: 0;
  color: #111111;
  font-size: 1.2rem;
  font-weight: 760;
  text-align: center;
}

.transcript-card,
.confirm-card,
.manual-card,
.dictation-fallback {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
}

.transcript-card {
  padding: 16px;
}

.transcript-card p:last-child {
  margin: 8px 0 0;
  color: #1d1b19;
  line-height: 1.45;
}

.section-kicker {
  font-size: 0.76rem;
  text-transform: uppercase;
}

.dictation-fallback {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.confirm-card,
.manual-card {
  padding: 18px;
}

.confirm-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.confirm-header h2 {
  margin-top: 5px;
  font-size: 1.12rem;
  font-weight: 780;
}

.confirm-header strong {
  color: #111111;
  font-size: 1.55rem;
  font-weight: 800;
  white-space: nowrap;
}

.confirm-header strong.income-amount {
  color: #0f8a4a;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 18px 0 0;
}

.detail-grid div {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-soft);
}

dd {
  margin: 6px 0 0;
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 740;
  overflow-wrap: anywhere;
}

.recommendation {
  margin: 16px 0 0;
  color: #45434b;
  font-size: 0.94rem;
  line-height: 1.45;
}

.confirm-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
}

.primary-action,
.secondary-action,
.ghost-action,
.text-action,
.filter-button {
  min-height: 42px;
  border-radius: 999px;
  font-weight: 760;
  letter-spacing: 0;
}

.primary-action,
.secondary-action,
.ghost-action {
  flex: 1;
  padding: 0 14px;
}

.primary-action {
  border: 0;
  color: #ffffff;
  background: #111111;
}

.secondary-action {
  border: 1px solid #111111;
  color: #111111;
  background: #ffffff;
}

.ghost-action,
.text-action,
.filter-button {
  border: 1px solid var(--line);
  color: #34323a;
  background: #ffffff;
}

.manual-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.full-field {
  grid-column: 1 / -1;
}

label {
  display: grid;
  gap: 7px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-soft);
  color: var(--text);
  outline: none;
}

input,
select {
  min-height: 46px;
  padding: 0 12px;
}

textarea {
  resize: vertical;
  padding: 12px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #111111;
}

.compact-actions {
  justify-content: flex-end;
}

.compact-actions .primary-action,
.compact-actions .ghost-action {
  flex: 0 1 132px;
}

.secondary-screen {
  place-items: stretch center;
}

.secondary-card {
  padding: 18px;
}

.secondary-header,
.secondary-actions,
.filter-row,
.history-item {
  display: flex;
  align-items: center;
}

.secondary-header {
  justify-content: space-between;
  gap: 14px;
}

.secondary-header h2 {
  margin-top: 4px;
  font-size: 1.24rem;
  font-weight: 790;
}

.secondary-actions {
  gap: 8px;
}

.text-action {
  min-width: 82px;
  padding: 0 14px;
}

.secondary-actions .icon-button {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: #24242a;
  background: #ffffff;
}

.filter-row {
  gap: 8px;
  margin-top: 18px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}

.filter-row::-webkit-scrollbar {
  display: none;
}

.filter-button {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 0 12px;
  color: #5d5a63;
  font-size: 0.82rem;
}

.filter-button.active {
  border-color: #111111;
  color: #ffffff;
  background: #111111;
}

.history-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.history-item {
  justify-content: space-between;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-soft);
}

.history-item div {
  min-width: 0;
}

.history-item h3 {
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.95rem;
  font-weight: 760;
}

.history-item p {
  margin: 5px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 680;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-item strong {
  color: #111111;
  font-size: 1rem;
  font-weight: 800;
  white-space: nowrap;
}

.history-item.income-item strong {
  color: #0f8a4a;
}

.empty-history {
  margin: 0;
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: 16px;
  color: var(--muted);
  text-align: center;
  line-height: 1.45;
}

@keyframes voice-pulse {
  0% {
    opacity: 0.64;
    transform: scale(1);
  }

  70% {
    opacity: 0;
    transform: scale(1.5);
  }

  100% {
    opacity: 0;
    transform: scale(1.5);
  }
}

@keyframes voice-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes voice-wave {
  0%,
  100% {
    transform: scaleY(0.55);
  }

  50% {
    transform: scaleY(1.18);
  }
}

@media (min-width: 520px) {
  body {
    display: grid;
    place-items: center;
    padding: 20px;
  }

  .app-shell {
    min-height: min(900px, calc(100svh - 40px));
    border-radius: 42px;
    overflow: hidden;
  }
}


.testing-tools {
  gap: 12px;
}

.testing-action-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #ffffff;
}

.testing-action-card strong {
  display: block;
  color: var(--text);
  font-size: 0.98rem;
  font-weight: 820;
}

.testing-action-card p,
.testing-action-card small {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 680;
  line-height: 1.4;
}

.advanced-danger {
  margin-top: 6px;
  border-color: rgba(197, 64, 47, 0.24);
  background: rgba(197, 64, 47, 0.04);
}

.danger-action {
  min-height: 44px;
  border: 0;
  border-radius: 999px;
  color: #ffffff;
  background: #c5402f;
  font-weight: 820;
}

.danger-action:disabled {
  cursor: not-allowed;
  opacity: 0.38;
}


.settings-summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.settings-summary-grid div {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-soft);
}

.settings-summary-grid span {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 760;
  text-transform: uppercase;
}

.settings-summary-grid strong {
  display: block;
  margin-top: 5px;
  color: var(--text);
  font-size: 1.06rem;
  font-weight: 820;
}

.fixed-editor {
  display: grid;
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.danger-mini-action {
  color: #c5402f;
  border-color: rgba(197, 64, 47, 0.28);
}

@media (max-width: 350px) {
  .protection-grid,
  .distribution-totals {
    grid-template-columns: 1fr;
  }

  .protection-result,
  .distribution-totals .distribution-result {
    grid-column: 1;
  }

  .protection-distribution-panel {
    padding: 8px;
  }
}
@media (max-width: 380px) {
  .hero-card {
    padding-inline: 24px;
    min-height: 452px;
  }

  .main-balance {
    font-size: clamp(2.58rem, 12vw, 3.08rem);
  }

  .hero-transaction {
    grid-template-columns: 20px minmax(76px, auto) minmax(0, 1fr) 14px;
    column-gap: 9px;
  }

  .hero-transaction strong,
  .hero-transaction p {
    font-size: 0.84rem;
  }

  .allowance-card {
    padding-inline: 24px;
    padding-top: 24px;
    gap: 12px;
  }

  .money-row strong {
    font-size: 1.68rem;
  }

  .row-icon {
    flex-basis: 50px;
    width: 50px;
    height: 50px;
  }

  .detail-grid,
  .manual-grid {
    grid-template-columns: 1fr;
  }

  .confirm-actions {
    flex-wrap: wrap;
  }

  .primary-action,
  .secondary-action,
  .ghost-action {
    flex-basis: 100%;
  }
}

.hero-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  width: 100%;
  gap: 16px;
}

.settings-button {
  display: grid;
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid rgba(225, 224, 233, 0.82);
  border-radius: 50%;
  color: #24242a;
  background: rgba(255, 255, 255, 0.7);
}

.settings-button svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.settings-screen {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: stretch center;
  padding: 14px;
  background: rgba(7, 7, 8, 0.34);
  backdrop-filter: blur(14px);
}

.settings-panel {
  width: min(100%, 430px);
  max-height: calc(100svh - 28px);
  overflow-y: auto;
  border: 1px solid rgba(232, 229, 235, 0.9);
  border-radius: 30px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: var(--shadow);
  padding: 18px;
}

.settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.settings-header h2,
.settings-form h3 {
  margin: 4px 0 0;
  font-size: 1.22rem;
  font-weight: 820;
}

.settings-header .icon-button {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: #24242a;
  background: #ffffff;
}

.settings-feedback {
  margin-top: 12px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: #34323a;
  background: var(--surface-soft);
  font-size: 0.86rem;
  font-weight: 700;
}

.settings-cards {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.settings-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 12px;
  width: 100%;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 18px;
  color: var(--text);
  background: #ffffff;
  text-align: left;
}

.settings-card span {
  color: #6f717a;
  font-size: 0.78rem;
  font-weight: 780;
  text-transform: uppercase;
}

.settings-card strong {
  overflow: hidden;
  font-size: 1rem;
  font-weight: 820;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-card small {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 680;
}

.settings-card em {
  grid-column: 2;
  grid-row: 1 / span 3;
  align-self: center;
  color: #777782;
  font-size: 0.82rem;
  font-style: normal;
  font-weight: 760;
}

.settings-detail {
  margin-top: 16px;
}

.back-settings {
  min-width: 74px;
  min-height: 36px;
  margin-bottom: 12px;
}

.settings-form {
  display: grid;
  gap: 12px;
}

.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.inline-check {
  display: flex;
  align-items: center;
  gap: 10px;
}

.inline-check input {
  width: 18px;
  min-height: 18px;
}

.inline-check span {
  color: #34323a;
  font-size: 0.86rem;
  font-weight: 740;
}

.compact-list {
  display: grid;
  gap: 8px;
}

.config-list-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 7px 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-soft);
}

.config-list-item strong,
.config-list-item p {
  margin: 0;
}

.config-list-item p {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 680;
}

.item-actions {
  display: flex;
  gap: 6px;
  grid-column: 1 / -1;
}

.mini-action {
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #34323a;
  background: #ffffff;
  font-size: 0.78rem;
  font-weight: 760;
}

.full-button {
  width: 100%;
}

.hours-box {
  display: grid;
  gap: 12px;
  margin-top: 4px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}


.testing-tools {
  gap: 12px;
}

.testing-action-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #ffffff;
}

.testing-action-card strong {
  display: block;
  color: var(--text);
  font-size: 0.98rem;
  font-weight: 820;
}

.testing-action-card p,
.testing-action-card small {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 680;
  line-height: 1.4;
}

.advanced-danger {
  margin-top: 6px;
  border-color: rgba(197, 64, 47, 0.24);
  background: rgba(197, 64, 47, 0.04);
}

.danger-action {
  min-height: 44px;
  border: 0;
  border-radius: 999px;
  color: #ffffff;
  background: #c5402f;
  font-weight: 820;
}

.danger-action:disabled {
  cursor: not-allowed;
  opacity: 0.38;
}


.settings-summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.settings-summary-grid div {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-soft);
}

.settings-summary-grid span {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 760;
  text-transform: uppercase;
}

.settings-summary-grid strong {
  display: block;
  margin-top: 5px;
  color: var(--text);
  font-size: 1.06rem;
  font-weight: 820;
}

.fixed-editor {
  display: grid;
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.danger-mini-action {
  color: #c5402f;
  border-color: rgba(197, 64, 47, 0.28);
}

@media (max-width: 380px) {
  .settings-grid {
    grid-template-columns: 1fr;
  }
}
/* Expanded history remains one continuous panel with its own handle and selected action. */
.hero-history {
  padding-top: 12px;
}

.hero-history > .hero-expand-button {
  justify-self: center;
  margin: -4px auto 8px;
  touch-action: manipulation;
}

.hero-history-feedback {
  margin: 10px 0 0;
  color: #0f8a4a;
  font-size: 0.78rem;
  font-weight: 760;
}

.hero-card.expanded .hero-history-list {
  max-height: min(31svh, 252px);
}

.hero-card.expanded .hero-transaction {
  width: 100%;
  border-inline: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.hero-card.expanded .hero-transaction:last-child {
  width: 100%;
  height: auto;
}

.hero-card.expanded .hero-transaction.selected {
  margin-inline: 0;
  width: 100%;
  max-width: 100%;
  padding-inline: 8px;
  border-radius: 8px;
  background: rgba(24, 24, 28, 0.045);
}

.hero-history-detail {
  margin-top: 12px;
  padding: 14px;
  border: 1px solid rgba(219, 217, 226, 0.9);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.selected-history-label,
.selected-history-summary {
  margin: 0;
}

.selected-history-label {
  color: #6f6e78;
  font-size: 0.71rem;
  font-weight: 780;
  text-transform: uppercase;
}

.selected-history-summary {
  margin-top: 5px;
  color: #2b2b31;
  font-size: 0.82rem;
  font-weight: 680;
  line-height: 1.4;
}

.selected-history-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  justify-items: start;
  align-items: start;
  gap: 16px;
  margin-top: 14px;
}

.selected-history-indicator {
  width: 12px;
  height: 12px;
  flex: 0 0 12px;
  border-radius: 50%;
  background: #c5402f;
  box-shadow: 0 0 0 5px rgba(197, 64, 47, 0.1);
}

.hero-history-detail.income .selected-history-indicator {
  background: #0f8a4a;
  box-shadow: 0 0 0 5px rgba(15, 138, 74, 0.1);
}

.delete-history-movement {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid rgba(197, 64, 47, 0.25);
  border-radius: 8px;
  color: #a62f22;
  background: rgba(197, 64, 47, 0.06);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 780;
}

.delete-history-movement:active {
  transform: translateY(1px);
  background: rgba(197, 64, 47, 0.12);
}

.delete-history-movement svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

.voice-dock,
.mic-cluster {
  width: 100%;
  justify-items: center;
  align-items: center;
}

/* Mobile history containment */
.hero-card.expanded,
.hero-card.expanded .hero-history,
.hero-card.expanded .hero-history-head,
.hero-card.expanded .hero-history-list,
.hero-card.expanded .hero-history-detail,
.hero-card.expanded .hero-transaction,
.hero-card.expanded .selected-history-actions,
.hero-card.expanded .delete-history-movement {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.hero-history > .hero-expand-button {
  position: static;
  transform: none;
  max-width: 44px;
}

.hero-history-head > * {
  min-width: 0;
}

.hero-history-head #hero-history-title {
  overflow-wrap: anywhere;
}

.hero-history-head #hero-history-count {
  flex: 0 0 auto;
  white-space: nowrap;
  text-transform: none;
}

.hero-card.expanded .hero-history-list {
  padding-right: 0;
}

.hero-card.expanded .hero-transaction {
  grid-template-columns: 30px minmax(76px, auto) minmax(0, 1fr) 12px;
  column-gap: 8px;
  overflow: hidden;
}

.hero-card.expanded .hero-transaction strong,
.hero-card.expanded .hero-transaction p,
.hero-card.expanded .hero-transaction small,
.selected-history-summary,
.delete-history-movement span {
  min-width: 0;
  max-width: 100%;
}

.hero-card.expanded .hero-transaction p,
.hero-card.expanded .hero-transaction small,
.selected-history-summary,
.delete-history-movement span {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.hero-card.expanded .hero-transaction.selected {
  margin-inline: 0;
  width: 100%;
  max-width: 100%;
  padding-inline: 8px;
  border-radius: 8px;
  background: rgba(24, 24, 28, 0.045);
}

.selected-history-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  justify-items: start;
  align-items: start;
  gap: 16px;
  margin-top: 14px;
}

.selected-history-indicator {
  margin-left: 5px;
}

.delete-history-movement {
  justify-content: flex-start;
  white-space: normal;
}

.voice-dock {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.mic-cluster {
  display: flex;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-inline: 0;
  box-sizing: border-box;
}

@media (max-width: 350px) {
  .hero-card.expanded .hero-transaction {
    grid-template-columns: 26px minmax(68px, auto) minmax(0, 1fr) 10px;
    column-gap: 6px;
  }

  .hero-history-detail {
    padding: 12px;
  }
}
/* Fixed-expense actions and period explanation */
.fixed-expense-item {
  grid-template-columns: minmax(0, 1fr);
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.fixed-expense-item > div:first-child,
.fixed-expense-item p,
.fixed-expense-item p span,
.fixed-expense-item p small {
  min-width: 0;
  max-width: 100%;
}

.fixed-expense-item p {
  display: grid;
  gap: 5px;
  margin-top: 7px;
  line-height: 1.4;
}

.fixed-expense-item p span {
  display: block;
  overflow-wrap: anywhere;
}

.fixed-expense-item p b {
  color: #34323a;
  font-weight: 790;
}

.fixed-expense-item p small {
  display: block;
  margin-top: 4px;
  color: #66636d;
  font-size: 0.8rem;
  font-weight: 680;
  line-height: 1.45;
}

.fixed-item-actions {
  display: grid;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.fixed-item-actions .mini-action {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 0.82rem;
  line-height: 1.25;
  white-space: normal;
}

.fixed-item-actions .mini-action:disabled {
  cursor: default;
  opacity: 0.55;
}
/* Mobile paycheck settings */
.settings-panel {
  padding-top: 0;
}

.settings-header {
  position: sticky;
  top: 0;
  z-index: 4;
  margin: 0 -18px;
  padding: 18px;
  border-bottom: 1px solid rgba(232, 229, 235, 0.82);
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(12px);
}

.back-settings {
  position: sticky;
  top: 79px;
  z-index: 3;
  background: rgba(255, 255, 255, 0.97);
}

.paycheck-actions {
  display: grid;
  gap: 10px;
  margin-top: 6px;
}

.paycheck-actions button {
  width: 100%;
  min-height: 48px;
  white-space: normal;
}

.hours-section {
  margin-top: 6px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.hours-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 50px;
  padding: 0 4px;
  border: 0;
  color: var(--text);
  background: transparent;
  font-size: 0.96rem;
  font-weight: 800;
  text-align: left;
}

.hours-chevron {
  flex: 0 0 auto;
  color: var(--muted);
  transition: transform 180ms ease;
}

.hours-toggle[aria-expanded="true"] .hours-chevron {
  transform: rotate(90deg);
}

.hours-box[hidden] {
  display: none;
}

@media (max-width: 400px) {
  .paycheck-form .settings-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .paycheck-form,
  .paycheck-form label,
  .paycheck-form input,
  .paycheck-form select,
  .paycheck-form textarea {
    min-width: 0;
    max-width: 100%;
  }
}
/* Long modal scrolling: fixed chrome, scrollable content */
html.long-panel-open,
body.long-panel-open {
  overflow: hidden;
  overscroll-behavior: none;
}

.state-explanation-panel,
.protection-distribution-panel,
.settings-screen {
  height: 100dvh;
  max-height: 100dvh;
  padding-top: max(14px, env(safe-area-inset-top));
  padding-right: max(14px, env(safe-area-inset-right));
  padding-bottom: max(14px, env(safe-area-inset-bottom));
  padding-left: max(14px, env(safe-area-inset-left));
  overflow: hidden;
  box-sizing: border-box;
}

.state-explanation-card,
.protection-distribution-card,
.settings-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(100%, 430px);
  max-width: 100%;
  height: min(100%, calc(100dvh - max(28px, env(safe-area-inset-top)) - max(28px, env(safe-area-inset-bottom))));
  max-height: 100%;
  min-height: 0;
  overflow: hidden;
  box-sizing: border-box;
}

.state-explanation-header,
.protection-distribution-header,
.settings-header {
  position: relative;
  inset: auto;
  z-index: 2;
  flex: 0 0 auto;
  margin: 0;
  padding: 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.98);
}

.state-explanation-content,
.protection-distribution-content {
  min-width: 0;
  min-height: 0;
  max-width: 100%;
  margin: 0;
  padding: 16px 18px 20px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #c8c7ce transparent;
}

.state-explanation-content::-webkit-scrollbar,
.protection-distribution-content::-webkit-scrollbar,
.settings-cards::-webkit-scrollbar,
.settings-detail::-webkit-scrollbar {
  width: 5px;
}

.state-explanation-content::-webkit-scrollbar-thumb,
.protection-distribution-content::-webkit-scrollbar-thumb,
.settings-cards::-webkit-scrollbar-thumb,
.settings-detail::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: #c8c7ce;
}

.state-explanation-footer {
  padding: 12px 18px max(12px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.98);
}

.settings-panel {
  grid-template-rows: auto minmax(0, 1fr);
  padding: 0;
}

.settings-feedback {
  position: absolute;
  z-index: 5;
  top: 82px;
  right: 18px;
  left: 18px;
}

.settings-cards,
.settings-detail {
  min-width: 0;
  min-height: 0;
  max-width: 100%;
  margin: 0;
  padding: 16px 18px max(18px, env(safe-area-inset-bottom));
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #c8c7ce transparent;
}

.settings-detail {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  align-content: start;
}

.settings-detail[hidden],
.settings-cards[hidden] {
  display: none;
}

.back-settings {
  position: sticky;
  top: 0;
  z-index: 3;
  margin: -16px -18px 12px;
  padding: 12px 18px;
  background: rgba(255, 255, 255, 0.98);
}

.paycheck-form {
  min-width: 0;
  max-width: 100%;
  padding-bottom: 86px;
}

.paycheck-actions {
  position: sticky;
  bottom: -1px;
  z-index: 3;
  margin: 8px -18px -86px;
  padding: 12px 18px max(12px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(12px);
}

@media (max-height: 560px) {
  .state-explanation-panel,
  .protection-distribution-panel,
  .settings-screen {
    padding-top: max(6px, env(safe-area-inset-top));
    padding-bottom: max(6px, env(safe-area-inset-bottom));
  }

  .state-explanation-card,
  .protection-distribution-card,
  .settings-panel {
    border-radius: 22px;
  }

  .state-explanation-header,
  .protection-distribution-header,
  .settings-header {
    padding-top: 12px;
    padding-bottom: 12px;
  }
}
.state-explanation-card,
.protection-distribution-card,
.settings-panel {
  position: relative;
  padding: 0;
}

.settings-detail .settings-form > .confirm-actions {
  position: sticky;
  bottom: -1px;
  z-index: 3;
  margin-right: -18px;
  margin-bottom: -1px;
  margin-left: -18px;
  padding: 12px 18px max(12px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(12px);
}
/* Responsive application shell: compact first, enhanced by available space. */
:root {
  --page-padding: clamp(12px, 3cqi, 32px);
  --card-padding: clamp(14px, 3cqi, 28px);
  --section-gap: clamp(12px, 2.5cqi, 28px);
  --content-compact: 100%;
  --content-medium: 720px;
  --content-expanded: 1100px;
  --content-large: 1280px;
  --content-xlarge: 1440px;
}

html {
  width: 100%;
  min-width: 0;
  min-height: 100%;
}

body {
  display: grid;
  width: 100%;
  min-width: 0;
  min-height: 100dvh;
  place-items: start center;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

img {
  max-width: 100%;
  height: auto;
}

svg {
  max-width: 100%;
}

.app-shell {
  container-type: inline-size;
  width: 100%;
  max-width: var(--content-compact);
  min-width: 0;
  min-height: calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  margin-inline: auto;
  grid-template-rows: auto clamp(88px, 13dvh, 110px) minmax(0, 1fr);
  box-sizing: border-box;
}

.app-shell > *,
.hero-card,
.voice-dock,
.allowance-card,
.flow-card,
.secondary-card,
.state-explanation-card,
.protection-distribution-card,
.settings-panel,
.settings-form,
.settings-grid,
.detail-grid,
.manual-grid,
.config-list-item,
.money-row,
.status-content {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.hero-card {
  min-height: clamp(400px, 55dvh, 520px);
  padding: max(var(--card-padding), env(safe-area-inset-top)) var(--card-padding) var(--card-padding);
}

.allowance-card {
  padding: var(--card-padding) var(--card-padding) max(var(--card-padding), env(safe-area-inset-bottom));
  gap: var(--section-gap);
}

.main-balance {
  max-width: 100%;
  font-size: clamp(2rem, 12cqi, 4rem);
}

.allowance-card > h2,
.settings-header h2,
.state-explanation-header h2,
.protection-distribution-header h2 {
  font-size: clamp(1.1rem, 5cqi, 1.45rem);
}

.money-row strong {
  max-width: 100%;
  font-size: clamp(1.48rem, 7.4cqi, 2rem);
  overflow-wrap: anywhere;
  white-space: normal;
}

.hero-transaction,
.hero-card.expanded .hero-transaction {
  grid-template-columns: 28px minmax(74px, auto) minmax(0, 1fr) 12px;
  column-gap: clamp(6px, 2.5cqi, 12px);
}

.hero-transaction strong,
.hero-transaction p,
.hero-transaction small,
.settings-card strong,
.settings-card small,
.config-list-item,
.distribution-obligation,
.explanation-block,
.testing-action-card {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}

button,
input:not([type="checkbox"]):not([type="radio"]),
select {
  min-height: 48px;
}

button {
  min-width: 48px;
}

textarea,
input,
select {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

input[type="checkbox"],
input[type="radio"] {
  width: 20px;
  min-width: 20px;
  height: 20px;
  min-height: 20px;
}

.inline-check {
  min-height: 48px;
}

.hero-expand-button,
.hero-view-all,
.settings-button,
.icon-button,
.status-icon-button,
.back-settings,
.mini-action,
.filter-button,
.distribution-trigger,
.hours-toggle,
.delete-history-movement {
  min-width: 48px;
  min-height: 48px;
}

.hero-expand-button {
  width: 48px;
  height: 48px;
  margin-block: -11px;
}

.settings-button,
.settings-header .icon-button,
.state-explanation-close,
.protection-distribution-close,
.status-icon-button {
  width: 48px;
  height: 48px;
  flex-basis: 48px;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--state);
  outline-offset: 3px;
}

.settings-grid,
.detail-grid,
.manual-grid,
.settings-summary-grid {
  grid-template-columns: minmax(0, 1fr);
}

.confirm-actions,
.compact-actions,
.item-actions,
.fixed-item-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}

.confirm-actions > *,
.compact-actions > *,
.item-actions > *,
.fixed-item-actions > * {
  width: 100%;
  min-width: 0;
  min-height: 48px;
}

.flow-panel,
.secondary-screen,
.protection-distribution-panel,
.state-explanation-panel,
.settings-screen {
  width: 100%;
  max-width: 100%;
  height: 100dvh;
  max-height: 100dvh;
  padding: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
  overflow: hidden;
}

.flow-card,
.secondary-card,
.protection-distribution-card,
.state-explanation-card,
.settings-panel {
  width: 100%;
  max-width: 100%;
  max-height: calc(100dvh - max(16px, env(safe-area-inset-top)) - max(16px, env(safe-area-inset-bottom)));
  overflow-x: clip;
}

body:has(.flow-panel:not([hidden])),
body:has(.secondary-screen:not([hidden])) {
  overflow: hidden;
  overscroll-behavior: none;
}

@media (width < 600px) {
  .app-shell {
    border-radius: 0;
    box-shadow: none;
  }

  .hero-card,
  .allowance-card {
    border-radius: clamp(22px, 8cqi, 32px);
  }

  .hero-card {
    border-top-left-radius: 0;
    border-top-right-radius: 0;
  }

  .allowance-card {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
  }

  .flow-card,
  .secondary-card,
  .protection-distribution-card,
  .state-explanation-card,
  .settings-panel {
    border-radius: clamp(20px, 7cqi, 30px);
  }
}

@media (600px <= width < 840px) {
  body {
    padding: var(--page-padding);
  }

  .app-shell {
    width: min(100%, var(--content-medium));
    min-height: calc(100dvh - (2 * var(--page-padding)));
    border-radius: 34px;
    overflow: clip;
  }

  .hero-card,
  .allowance-card {
    padding-inline: clamp(28px, 6cqi, 44px);
  }

  .settings-grid,
  .detail-grid,
  .manual-grid,
  .settings-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .confirm-actions,
  .compact-actions,
  .item-actions,
  .fixed-item-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .flow-card,
  .secondary-card,
  .protection-distribution-card,
  .state-explanation-card {
    width: min(100%, 680px);
  }

  .settings-panel {
    width: min(100%, 760px);
  }
}

@media (840px <= width < 1200px) {
  body {
    place-items: center;
    padding: var(--page-padding);
  }

  .app-shell {
    width: min(100%, var(--content-expanded));
    min-height: min(900px, calc(100dvh - (2 * var(--page-padding))));
    grid-template-columns: minmax(360px, 0.92fr) minmax(0, 1.08fr);
    grid-template-rows: minmax(0, 1fr) 112px;
    border-radius: 38px;
    overflow: clip;
  }

  .hero-card {
    grid-column: 1;
    grid-row: 1;
    min-height: 0;
    border-radius: 0 0 32px 0;
  }

  .voice-dock {
    grid-column: 1;
    grid-row: 2;
  }

  .allowance-card {
    grid-column: 2;
    grid-row: 1 / span 2;
    min-height: 100%;
    border-radius: 0;
    padding: clamp(26px, 4cqi, 42px);
  }

  .settings-grid,
  .detail-grid,
  .manual-grid,
  .settings-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .confirm-actions,
  .compact-actions,
  .item-actions,
  .fixed-item-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .flow-card,
  .secondary-card,
  .protection-distribution-card,
  .state-explanation-card {
    width: min(100%, 720px);
  }

  .settings-panel {
    width: min(100%, 820px);
  }
}

@media (1200px <= width < 1600px) {
  body {
    place-items: center;
    padding: var(--page-padding);
  }

  .app-shell {
    width: min(100%, var(--content-large));
    min-height: min(900px, calc(100dvh - (2 * var(--page-padding))));
    grid-template-columns: minmax(400px, 0.9fr) minmax(0, 1.1fr);
    grid-template-rows: minmax(0, 1fr) 116px;
    border-radius: 40px;
    overflow: clip;
  }

  .hero-card { grid-column: 1; grid-row: 1; min-height: 0; border-radius: 0 0 34px 0; }
  .voice-dock { grid-column: 1; grid-row: 2; }
  .allowance-card { grid-column: 2; grid-row: 1 / span 2; min-height: 100%; border-radius: 0; padding: clamp(30px, 4cqi, 48px); }

  .settings-grid,
  .detail-grid,
  .manual-grid,
  .settings-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .flow-card,
  .secondary-card,
  .protection-distribution-card,
  .state-explanation-card { width: min(100%, 760px); }
  .settings-panel { width: min(100%, 900px); }
}

@media (width >= 1600px) {
  body {
    place-items: center;
    padding: var(--page-padding);
  }

  .app-shell {
    width: min(100%, var(--content-xlarge));
    min-height: min(920px, calc(100dvh - (2 * var(--page-padding))));
    grid-template-columns: minmax(440px, 0.88fr) minmax(0, 1.12fr);
    grid-template-rows: minmax(0, 1fr) 120px;
    border-radius: 42px;
    overflow: clip;
  }

  .hero-card { grid-column: 1; grid-row: 1; min-height: 0; border-radius: 0 0 36px 0; }
  .voice-dock { grid-column: 1; grid-row: 2; }
  .allowance-card { grid-column: 2; grid-row: 1 / span 2; min-height: 100%; border-radius: 0; padding: 48px; }
  .flow-card, .secondary-card, .protection-distribution-card, .state-explanation-card { width: min(100%, 800px); }
  .settings-panel { width: min(100%, 960px); }
}

@media (height < 480px) and (orientation: landscape) {
  body {
    place-items: start center;
    padding-block: max(6px, env(safe-area-inset-top)) max(6px, env(safe-area-inset-bottom));
  }

  .app-shell {
    width: min(100%, var(--content-medium));
    min-height: calc(100dvh - 12px);
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto 82px auto;
    border-radius: 24px;
    overflow: clip;
  }

  .hero-card,
  .voice-dock,
  .allowance-card {
    grid-column: 1;
    grid-row: auto;
  }

  .hero-card {
    min-height: 300px;
    padding-block: 18px 14px;
    border-radius: 0 0 24px 24px;
  }

  .currency-pill { margin-top: 14px; }
  .main-balance { margin-top: 12px; }
  .hero-history { margin-top: 18px; padding-top: 12px; }
  .allowance-card { min-height: 0; border-radius: 24px 24px 0 0; }
}
@media (width >= 840px) and (480px <= height < 820px) {
  .allowance-card {
    gap: 10px;
    padding: 22px 28px;
  }

  .money-row strong,
  .money-row small {
    margin-top: 4px;
  }

  .protection-summary {
    gap: 8px;
  }

  .status-card {
    margin-top: 0;
    padding: 14px;
  }

  .status-content {
    gap: 10px;
    margin-top: 10px;
  }
}
/* Money Control visual redesign: warm, compact and voice-first. */
:root {
  --bg: #efebe6;
  --surface: #ffffff;
  --surface-soft: #f1eeea;
  --text: #161513;
  --muted: #8a857e;
  --line: #ece9e4;
  --brand: #e65347;
  --brand-strong: #c9422f;
  --brand-soft: #fbeae7;
  --brand-light: rgba(255, 255, 255, 0.85);
  --shell: #f5f2ed;
  --shadow: 0 28px 72px rgba(72, 50, 40, 0.14);
}

html,
body {
  background: var(--bg);
}

body {
  background-image: none;
}

.app-shell {
  gap: 12px;
  padding: 14px;
  padding-bottom: 112px;
  background: var(--shell);
  box-shadow: 0 28px 72px rgba(40, 46, 39, 0.14);
}

.hero-card,
.hero-card.expanded {
  display: grid;
  gap: 18px;
  min-height: 0;
  padding: 4px 0 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.hero-card::after {
  display: none;
}

.hero-header-row {
  align-items: center;
  padding-inline: 4px;
}

.welcome-copy {
  display: grid;
  gap: 2px;
}

.eyebrow {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 690;
  line-height: 1.2;
}

.hero-card h1 {
  margin: 0;
  color: var(--text);
  font-size: clamp(1.2rem, 5cqi, 1.5rem);
  font-weight: 790;
  line-height: 1.08;
}

.settings-button {
  color: #5f625c;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 7px 20px rgba(38, 43, 37, 0.06);
}

.balance-card {
  container-type: inline-size;
  display: grid;
  width: 100%;
  min-width: 0;
  padding: clamp(18px, 5cqi, 26px);
  border-radius: clamp(20px, 6cqi, 26px);
  color: #ffffff;
  background: var(--brand);
  box-shadow: 0 20px 42px rgba(230, 83, 71, 0.24);
}

.balance-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--brand-light);
  font-size: 0.78rem;
  font-weight: 720;
}

.currency-pill {
  justify-self: auto;
  margin: 0;
  padding: 4px 10px;
  color: #ffffff;
  border: 0;
  background: rgba(255, 255, 255, 0.18);
  box-shadow: none;
  font-size: 0.72rem;
}

.currency-pill strong {
  color: inherit;
}

.main-balance {
  justify-self: start;
  margin-top: 10px;
  color: #ffffff;
  font-size: clamp(2.35rem, 13cqi, 4.35rem);
  font-weight: 760;
  line-height: 1;
}

.balance-caption {
  justify-self: start;
  margin-top: 6px;
  color: var(--brand-light);
  font-size: 0.78rem;
  font-weight: 680;
}

.balance-card .hero-history {
  margin-top: 18px;
  padding-top: 12px;
  border-top-color: rgba(255, 255, 255, 0.25);
}

.balance-card .hero-expand-button span {
  background: rgba(255, 255, 255, 0.35);
}

.balance-card .hero-history-head p,
.balance-card .hero-history-head span,
.balance-card .hero-view-all,
.balance-card .hero-history-empty,
.balance-card .hero-history-feedback {
  color: rgba(255, 255, 255, 0.78);
}

.balance-card .hero-transaction {
  border-bottom-color: rgba(255, 255, 255, 0.18);
}

.balance-card .hero-transaction p {
  color: #ffffff;
}

.balance-card .hero-transaction small {
  color: rgba(255, 255, 255, 0.72);
}

.balance-card .hero-transaction strong {
  color: #ffe3de;
}

.balance-card .hero-transaction.income strong {
  color: #d3f5e6;
}

.balance-card .hero-indicator {
  background: rgba(255, 255, 255, 0.18);
}

.balance-card .hero-transaction.income .hero-indicator {
  background: rgba(211, 245, 230, 0.2);
}

.balance-card .hero-chevron {
  border-color: rgba(255, 255, 255, 0.55);
}

.balance-card .hero-history-detail {
  border-color: rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.1);
}

.balance-card .selected-history-label,
.balance-card .selected-history-summary {
  color: rgba(255, 255, 255, 0.92);
}

.allowance-card {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 0;
  border-radius: 0;
  background: transparent;
}

.allowance-card > h2 {
  grid-column: 1 / -1;
  margin: 4px 2px 0;
  color: var(--text);
  font-size: 1.12rem;
  font-weight: 790;
}

.money-row {
  display: grid;
  align-content: start;
  min-height: 118px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: #ffffff;
  box-shadow: 0 8px 24px rgba(38, 43, 37, 0.035);
}

.money-row > div {
  display: flex;
  flex-direction: column;
}

.money-row > div > span {
  order: 2;
  margin-top: 4px;
  font-size: 0.75rem;
  line-height: 1.35;
}

.money-row strong {
  order: 1;
  margin-top: 0;
  color: var(--text);
  font-size: clamp(1.22rem, 7.5cqi, 1.7rem);
  font-weight: 760;
}

.money-row small {
  order: 3;
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.money-row .row-icon,
.money-divider {
  display: none;
}

.protection-summary {
  grid-column: 1 / -1;
  gap: 11px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: #ffffff;
  box-shadow: 0 8px 24px rgba(38, 43, 37, 0.035);
}

.protection-summary h3 {
  font-size: 0.96rem;
}

.protection-grid {
  gap: 8px 16px;
}

.protection-grid .protection-stat:nth-child(3) {
  grid-column: 1 / -1;
}

.protection-stat dt {
  font-size: 0.7rem;
}

.protection-stat dd {
  font-size: 0.92rem;
}

.protection-result {
  padding-top: 7px;
}

.protection-progress {
  --protection-progress: 0%;
  width: 100%;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #eceee9;
}

.protection-progress span {
  display: block;
  width: var(--protection-progress);
  max-width: 100%;
  height: 100%;
  border-radius: inherit;
  background: var(--brand);
  transition: width 260ms ease;
}

.protection-progress-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #666a63;
  font-size: 0.75rem;
  font-weight: 680;
}

.protection-progress-meta span::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--brand);
}

.protection-progress-meta strong {
  color: var(--state);
  font-size: inherit;
}

.distribution-trigger {
  color: #4f534d;
  border-top-color: var(--line);
}

.status-card {
  grid-column: 1 / -1;
  margin: 0;
  padding: 16px;
  border: 1px solid color-mix(in srgb, var(--state) 22%, white);
  border-radius: 17px;
  background: color-mix(in srgb, var(--state) 10%, white);
  box-shadow: none;
}

.status-card h2 {
  font-size: 0.78rem;
  color: color-mix(in srgb, var(--state) 72%, #1d1d1a);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.status-content {
  grid-template-columns: 12px minmax(0, 1fr) 48px;
  gap: 12px;
  margin-top: 10px;
}

.status-content strong {
  font-size: 1.1rem;
}

.status-content p {
  margin-top: 4px;
  color: color-mix(in srgb, var(--state) 66%, #595c56);
  font-size: 0.78rem;
  line-height: 1.42;
}

.status-icon-button {
  background: color-mix(in srgb, var(--state) 14%, white);
}

.voice-dock {
  z-index: 12;
  min-height: 82px;
  padding: 8px 12px;
  border: 1px solid rgba(236, 233, 228, 0.92);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 16px 42px rgba(70, 45, 35, 0.14);
  backdrop-filter: blur(16px);
}

.mic-cluster {
  gap: 3px;
  transform: none;
}

.mic-cluster > span {
  color: #6f736c;
  font-size: 0.68rem;
}

.mic-button {
  width: 58px;
  height: 58px;
  border: 0;
  border-radius: 50%;
  color: #ffffff;
  background: var(--brand);
  box-shadow: 0 10px 24px rgba(230, 83, 71, 0.32);
}

.mic-icon {
  width: 28px;
  height: 28px;
  stroke-width: 1.9;
}

.mic-ripple {
  border-radius: 50%;
}

.flow-card,
.secondary-card,
.protection-distribution-card,
.state-explanation-card,
.settings-panel {
  color: var(--text);
  background: #f8f9f6;
  border-color: #dde0d9;
  box-shadow: 0 28px 80px rgba(40, 46, 39, 0.2);
}

.settings-card,
.config-list-item,
.testing-action-card,
.fixed-editor,
.transcript-card,
.confirm-card,
.manual-card {
  border-color: var(--line);
  background: #ffffff;
}

.primary-action {
  color: #ffffff;
  background: var(--brand);
}

.secondary-action {
  color: var(--brand-strong);
  border-color: color-mix(in srgb, var(--brand) 24%, white);
  background: #ffffff;
}

@media (width < 840px) {
  .voice-dock {
    position: fixed;
    right: max(12px, env(safe-area-inset-right));
    bottom: max(10px, env(safe-area-inset-bottom));
    left: max(12px, env(safe-area-inset-left));
    width: auto;
    max-width: 680px;
    margin-inline: auto;
  }
}

@media (width < 600px) {
  .app-shell {
    padding: 14px;
    padding-bottom: 112px;
    border-radius: 0;
    background: var(--shell);
  }

  .hero-card,
  .allowance-card {
    border-radius: 0;
  }

  .balance-card {
    border-radius: 22px;
  }
}

@media (600px <= width < 840px) {
  .app-shell {
    gap: 16px;
    padding: 20px;
    padding-bottom: 116px;
    background: var(--shell);
  }

  .hero-card {
    gap: 22px;
  }

  .balance-card,
  .protection-summary,
  .money-row,
  .status-card {
    border-radius: 20px;
  }

  .allowance-card {
    gap: 12px;
  }
}

@media (width >= 840px) {
  .app-shell {
    gap: 14px;
    padding: 18px;
    background: var(--shell);
  }

  .hero-card,
  .hero-card.expanded {
    grid-column: 1;
    grid-row: 1;
    align-content: start;
    min-height: 0;
    padding: 8px 4px 0;
    border-radius: 0;
  }

  .voice-dock {
    position: relative;
    grid-column: 1;
    grid-row: 2;
    min-height: 92px;
    border-radius: 20px;
  }

  .allowance-card {
    grid-column: 2;
    grid-row: 1 / span 2;
    align-self: stretch;
    align-content: start;
    min-height: 100%;
    padding: 8px;
    border-radius: 0;
  }

  .balance-card {
    min-height: 0;
  }

  .money-row {
    min-height: 126px;
  }
}

@media (width >= 1200px) {
  .app-shell {
    padding: 22px;
    gap: 18px;
  }

  .hero-card,
  .hero-card.expanded {
    padding: 10px 6px 0;
  }

  .allowance-card {
    gap: 14px;
    padding: 10px;
  }

  .balance-card {
    padding: 28px;
  }
}

@media (height < 480px) and (orientation: landscape) {
  .app-shell {
    padding: 10px;
    padding-bottom: 104px;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto;
  }

  .hero-card,
  .allowance-card {
    grid-column: 1;
    grid-row: auto;
  }

  .hero-card {
    min-height: 0;
    padding: 0;
  }

  .balance-card {
    padding-block: 16px;
  }

  .allowance-card {
    min-height: 0;
    padding: 0;
  }
}
@media (width < 350px) {
  .voice-dock {
    right: max(12px, env(safe-area-inset-right));
    left: auto;
    width: 72px;
    min-height: 72px;
    padding: 7px;
    border-radius: 50%;
  }

  .voice-dock .mic-cluster > span {
    display: none;
  }

  .voice-dock .mic-button {
    width: 56px;
    height: 56px;
  }
}
/* Reserve the document scroll space occupied by the fixed mobile voice dock. */
:root {
  --voice-dock-height: 93px;
  --voice-dock-content-gap: 18px;
  --voice-dock-edge-gap: 10px;
  --voice-dock-safe-area: env(safe-area-inset-bottom, 0px);
  --voice-dock-bottom-offset: calc(var(--voice-dock-edge-gap) + var(--voice-dock-safe-area));
  --voice-dock-scroll-clearance: calc(
    var(--voice-dock-height) +
    var(--voice-dock-content-gap) +
    var(--voice-dock-bottom-offset)
  );
}

@media (width < 840px) {
  html {
    scroll-padding-bottom: var(--voice-dock-scroll-clearance);
  }

  .app-shell {
    overflow: visible;
  }

  .allowance-card::after {
    content: "";
    grid-column: 1 / -1;
    width: 100%;
    height: var(--voice-dock-scroll-clearance);
    pointer-events: none;
    background: linear-gradient(to top, var(--bg, #efebe6) 45%, transparent);
  }

  .voice-dock {
    bottom: var(--voice-dock-bottom-offset);
  }
}

@media (width < 350px) {
  :root {
    --voice-dock-height: 72px;
    --voice-dock-content-gap: 16px;
  }
}

/* Onboarding: conversational first-run setup, same visual language as the Home. */
.onboarding-screen {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  min-height: 100dvh;
  box-sizing: border-box;
  padding: max(16px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom))
    max(18px, env(safe-area-inset-left));
  background: var(--bg);
  transition: opacity 360ms ease;
}

.onboarding-screen.onboarding-leaving {
  opacity: 0;
  pointer-events: none;
}

.onboarding-topbar,
.onboarding-dots,
.onboarding-stage,
.onboarding-actions {
  width: 100%;
  max-width: 430px;
}

.onboarding-topbar {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: space-between;
  min-height: 28px;
}

.onboarding-brand {
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 790;
  letter-spacing: -0.01em;
}

.onboarding-exit {
  min-height: 36px;
  padding: 6px 4px;
  border: 0;
  color: var(--muted);
  background: transparent;
  font-size: 0.78rem;
  font-weight: 700;
}

.onboarding-dots {
  display: flex;
  flex-shrink: 0;
  gap: 6px;
  margin-top: 16px;
}

.onboarding-dots span {
  flex: 1;
  height: 4px;
  border-radius: 999px;
  background: var(--line);
  transition: background 260ms ease;
}

.onboarding-dots span.filled {
  background: var(--brand);
}

.onboarding-stage {
  display: flex;
  flex: 1;
  flex-direction: column;
  justify-content: center;
  min-height: 0;
  padding-block: 16px;
}

.onboarding-card {
  box-sizing: border-box;
  padding: 32px 26px;
  border-radius: 24px;
  box-shadow: 0 2px 16px rgba(22, 21, 19, 0.05);
  animation: onboardingBreathe 7s ease-in-out infinite;
  transition: min-height 260ms ease;
}

.onboarding-card.onboarding-anim {
  animation:
    onboardingIn 360ms cubic-bezier(0.22, 1, 0.36, 1),
    onboardingBreathe 7s ease-in-out infinite 360ms;
}

.onboarding-card.onboarding-surface-brand {
  color: #ffffff;
  text-align: center;
  background: var(--brand);
}

.onboarding-card.onboarding-surface-plain {
  border: 1px solid var(--line);
  background: var(--surface, #ffffff);
}

@keyframes onboardingIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes onboardingBreathe {
  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.006);
  }
}

@media (prefers-reduced-motion: reduce) {
  .onboarding-screen,
  .onboarding-card,
  .onboarding-card.onboarding-anim,
  .onboarding-dots span {
    animation: none !important;
    transition: none !important;
  }
}

.onboarding-kicker {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.onboarding-question {
  margin: 0 0 18px;
  color: var(--text);
  font-size: 1.32rem;
  font-weight: 740;
  line-height: 1.25;
}

.onboarding-card.onboarding-surface-brand .onboarding-title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.3;
}

.onboarding-card.onboarding-surface-brand .onboarding-subtitle {
  margin: 12px 0 0;
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.95rem;
  line-height: 1.5;
}

.onboarding-input {
  box-sizing: border-box;
  width: 100%;
  min-height: 48px;
  padding: 16px 18px;
  border: 2px solid var(--line);
  border-radius: 16px;
  color: var(--text);
  background: #ffffff;
  font: inherit;
  font-size: 1.32rem;
  font-weight: 740;
  text-align: center;
}

.onboarding-input:focus-visible {
  border-color: var(--brand);
}

.onboarding-amount-field {
  position: relative;
}

.onboarding-amount-field .onboarding-input {
  padding-left: 34px;
  font-size: 1.85rem;
}

.onboarding-amount-prefix {
  position: absolute;
  top: 50%;
  left: 18px;
  color: var(--muted);
  font-size: 1.85rem;
  font-weight: 740;
  transform: translateY(-50%);
  pointer-events: none;
}

.onboarding-choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.onboarding-choice {
  display: flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  padding: 14px 16px;
  border: 2px solid var(--line);
  border-radius: 14px;
  color: var(--text);
  background: #ffffff;
  font-size: 0.95rem;
  font-weight: 660;
  text-align: center;
  transition:
    background 200ms ease,
    border-color 200ms ease,
    color 200ms ease;
}

.onboarding-choice.selected {
  border-color: var(--brand);
  color: var(--brand-strong);
  background: var(--brand-soft);
}

.onboarding-summary {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 18px;
  padding: 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.14);
  text-align: left;
}

.onboarding-summary-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.83rem;
}

.onboarding-summary-row strong {
  font-weight: 730;
}

.onboarding-actions {
  display: flex;
  flex-shrink: 0;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding-top: 14px;
}

.onboarding-primary {
  flex: none;
  width: 100%;
  max-width: 320px;
}

.primary-action:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.onboarding-back {
  min-height: 36px;
  padding: 6px 10px;
  border: 0;
  color: var(--muted);
  background: transparent;
  font-size: 0.82rem;
  font-weight: 660;
}

@media (width >= 600px) {
  .onboarding-screen {
    justify-content: center;
    padding-top: max(28px, env(safe-area-inset-top));
  }
}

/* Danger zone: unified "Borrar y reiniciar" card and its confirmation dialog. */
.danger-zone-options {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.danger-zone-option {
  display: grid;
  gap: 12px;
}

.danger-zone-option:not(:first-child) {
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.danger-confirm-warning {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 14px 0 0;
  padding: 12px 14px;
  border: 1px solid rgba(197, 64, 47, 0.28);
  border-radius: 14px;
  background: rgba(197, 64, 47, 0.06);
  color: #9a3323;
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1.4;
}

.danger-confirm-warning svg {
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  margin-top: 1px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}