:root {
  color-scheme: light;
  --paper: #f8f5ef;
  --card: #ffffff;
  --ink: #26283e;
  --muted: #696b7e;
  --purple: #5c5aa7;
  --purple-dark: #48468f;
  --purple-soft: #e3dff6;
  --line: #d6d2e4;
  --success: #30805c;
  --danger: #b33951;
  --shadow: 0 24px 70px rgba(38, 40, 62, .12);
  font-family: Inter, ui-rounded, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--paper); }
body { margin: 0; min-width: 280px; min-height: 100vh; min-height: 100dvh; background: var(--paper); color: var(--ink); }
button, input, select { font: inherit; }
button, a, input, select { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
img { max-width: 100%; }
.noscript { margin: 40px auto; padding: 24px; max-width: 520px; text-align: center; }

.page-shell {
  min-height: 100vh;
  min-height: 100dvh;
  padding: max(22px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) max(28px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
}

.welcome-page {
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 15% 18%, rgba(227, 223, 246, .9), transparent 30rem),
    radial-gradient(circle at 90% 85%, rgba(246, 218, 188, .65), transparent 28rem),
    var(--paper);
}

.welcome-card {
  width: min(100%, 1040px);
  min-height: min(720px, calc(100dvh - 44px));
  display: grid;
  grid-template-columns: 1.08fr .92fr;
  overflow: hidden;
  border: 1px solid rgba(92, 90, 167, .12);
  border-radius: 40px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.welcome-art {
  position: relative;
  display: grid;
  place-items: center;
  padding: 48px;
  overflow: hidden;
  background: linear-gradient(145deg, #efecfb 0%, #ddd8f3 60%, #f4d9c7 100%);
}

.welcome-art::before,
.welcome-art::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(92, 90, 167, .18);
}
.welcome-art::before { width: 480px; height: 480px; }
.welcome-art::after { width: 620px; height: 620px; }
.family-illustration { position: relative; z-index: 1; width: min(100%, 430px); filter: drop-shadow(0 18px 24px rgba(38, 40, 62, .14)); }
.family-illustration .ground { fill: rgba(255,255,255,.42); stroke: rgba(92,90,167,.25); stroke-width: 3; }
.family-illustration .body { fill: #fff; stroke: var(--purple); stroke-width: 7; stroke-linecap: round; stroke-linejoin: round; }
.family-illustration .head { fill: #f2c9a8; stroke: var(--purple); stroke-width: 7; }
.family-illustration .accent { fill: #f0a87d; stroke: var(--purple); stroke-width: 7; }
.family-illustration .line { fill: none; stroke: var(--purple); stroke-width: 7; stroke-linecap: round; stroke-linejoin: round; }

.welcome-copy { display: flex; flex-direction: column; justify-content: center; padding: clamp(42px, 7vw, 88px); }
.brand-kicker { margin: 0 0 16px; color: var(--purple); font-size: 13px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
h1, h2, h3, p { overflow-wrap: anywhere; }
.welcome-copy h1 { margin: 0; max-width: 500px; font-size: clamp(42px, 5.4vw, 72px); line-height: .99; letter-spacing: -.045em; }
.welcome-copy .lead { margin: 24px 0 34px; max-width: 450px; color: var(--muted); font-size: clamp(17px, 2vw, 21px); line-height: 1.6; }
.welcome-actions { display: grid; gap: 13px; max-width: 390px; }
.version-label { margin-top: 24px; color: #9293a2; font-size: 12px; }

.button {
  min-height: 56px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 13px 22px;
  border: 1.5px solid transparent;
  border-radius: 999px;
  font-weight: 800;
  text-decoration: none;
  transition: transform .16s ease, box-shadow .16s ease, background .16s ease;
}
.button:hover { transform: translateY(-1px); }
.button:active { transform: translateY(0); }
.button:focus-visible, .icon-button:focus-visible, .text-button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid rgba(92,90,167,.27); outline-offset: 2px; }
.button-primary { color: #fff; background: var(--purple); box-shadow: 0 9px 20px rgba(92,90,167,.22); }
.button-primary:hover { background: var(--purple-dark); }
.button-secondary { color: var(--purple); border-color: var(--purple); background: #fff; }
.button-danger { color: #fff; background: var(--danger); }
.button:disabled { opacity: .62; cursor: wait; transform: none; }
.button-wide { width: 100%; }
.button[hidden], .field[hidden] { display: none; }

.form-page { display: grid; place-items: start center; background: var(--paper); }
.form-card {
  width: min(100%, 570px);
  margin: 16px auto 30px;
  padding: clamp(26px, 5vw, 48px);
  border: 1px solid rgba(92,90,167,.12);
  border-radius: 32px;
  background: var(--card);
  box-shadow: 0 18px 55px rgba(38,40,62,.08);
}
.back-button { display: inline-flex; align-items: center; margin: -6px 0 26px; padding: 8px 0; border: 0; color: var(--purple); background: transparent; font-weight: 800; }
.form-card h1 { margin: 0; font-size: clamp(34px, 7vw, 48px); line-height: 1.05; letter-spacing: -.035em; }
.form-intro { margin: 13px 0 30px; color: var(--muted); font-size: 16px; line-height: 1.55; }
.form-stack { display: grid; gap: 14px; }
.postcode-lookup-row { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: end; gap: 10px; }
.postcode-lookup-row .field { min-width: 0; }
.postcode-lookup-button { min-height: 58px; margin: 0; padding-left: 19px; padding-right: 19px; white-space: nowrap; }
.postcode-status { margin-top: -6px; }
.field { display: grid; gap: 7px; }
.field > span, .field > label { color: var(--ink); font-size: 13px; font-weight: 800; }
.field input, .field select {
  width: 100%;
  min-height: 58px;
  padding: 0 17px;
  border: 1.5px solid var(--line);
  border-radius: 16px;
  color: var(--ink);
  background: #fff;
  font-size: 16px;
}
.field input:focus, .field select:focus { border-color: var(--purple); outline: 3px solid rgba(92,90,167,.13); }
.field input::placeholder { color: #9293a2; }
.date-control { position: relative; display: grid; grid-template-columns: minmax(0,1fr) 58px; }
.field .date-control .date-text { border-radius: 16px 0 0 16px; }
.calendar-button { min-height: 58px; display: grid; place-items: center; border: 1.5px solid var(--purple); border-left: 0; border-radius: 0 16px 16px 0; color: var(--purple); background: var(--purple-soft); font-size: 23px; }
.calendar-button:hover { background: #d7d1f2; }
.calendar-button:focus-visible { position: relative; z-index: 2; outline: 3px solid rgba(92,90,167,.27); outline-offset: 2px; }
.field .date-control .date-browser { position: absolute; right: 0; bottom: 0; width: 1px; min-height: 1px; height: 1px; padding: 0; border: 0; opacity: 0; pointer-events: none; }
.property-form { max-width: 620px; }
.form-links { display: grid; gap: 4px; margin-top: 12px; text-align: center; }
.text-button { padding: 10px; border: 0; color: var(--purple); background: transparent; font-weight: 800; text-decoration: none; }
.form-status { min-height: 22px; margin: 4px 0; color: var(--muted); text-align: center; font-size: 14px; line-height: 1.45; }
.form-status.success { color: var(--success); }
.form-status.error { color: var(--danger); }
.remaining { margin: -2px 0 3px; color: var(--muted); text-align: right; font-size: 13px; }

.photo-picker { display: grid; justify-items: center; gap: 7px; margin: -4px 0 18px; }
.avatar-button { width: 124px; height: 124px; padding: 0; overflow: hidden; border: 3px solid #fff; border-radius: 50%; background: var(--purple-soft); box-shadow: 0 0 0 2px var(--line), 0 10px 25px rgba(38,40,62,.12); }
.avatar-button img { width: 100%; height: 100%; display: block; object-fit: cover; }
.avatar-placeholder { width: 100%; height: 100%; display: grid; place-items: center; color: var(--purple); }
.avatar-placeholder svg { width: 72%; height: 72%; }
.photo-help { margin: 0; color: var(--purple); font-size: 14px; font-weight: 800; }

.dashboard-page { min-height: 100vh; min-height: 100dvh; padding: max(18px,env(safe-area-inset-top)) max(20px,env(safe-area-inset-right)) 40px max(20px,env(safe-area-inset-left)); }
.dashboard-wrap { width: min(100%, 1220px); margin: auto; }
.topbar { position: relative; display: grid; grid-template-columns: 58px 1fr auto; align-items: center; gap: 14px; padding: 12px; border: 1px solid rgba(92,90,167,.12); border-radius: 30px; background: #fff; box-shadow: 0 10px 35px rgba(38,40,62,.07); }
.icon-button { width: 54px; height: 54px; display: grid; place-items: center; border: 0; border-radius: 50%; color: var(--purple); background: #f1eefb; font-size: 25px; }
.greeting { min-width: 0; }
.greeting small { display: block; color: var(--muted); font-weight: 600; }
.greeting strong { display: block; overflow: hidden; font-size: 22px; text-overflow: ellipsis; white-space: nowrap; }
.profile-shortcut { display: grid; grid-template-columns: auto auto; align-items: center; gap: 9px; padding: 5px 9px 5px 5px; border: 0; border-radius: 999px; color: var(--purple); background: transparent; font-weight: 800; }
.mini-avatar { width: 48px; height: 48px; overflow: hidden; border: 2px solid var(--purple-soft); border-radius: 50%; background: var(--purple-soft); object-fit: cover; }
.menu-popover { position: absolute; z-index: 20; top: 78px; left: 9px; width: 210px; padding: 8px; border: 1px solid var(--line); border-radius: 18px; background: #fff; box-shadow: 0 14px 40px rgba(38,40,62,.16); }
.menu-popover[hidden] { display: none; }
.menu-popover button { width: 100%; padding: 13px 14px; border: 0; border-radius: 12px; color: var(--ink); background: transparent; text-align: left; font-weight: 700; }
.menu-popover button:hover { background: #f4f1fb; }
.empty-card { min-height: 360px; display: grid; place-items: center; margin-top: clamp(34px, 7vw, 70px); padding: 44px 28px; border: 1px solid rgba(92,90,167,.12); border-radius: 30px; background: #fff; box-shadow: 0 15px 50px rgba(38,40,62,.07); text-align: center; }
.empty-icon { width: 94px; height: 94px; display: grid; place-items: center; margin: 0 auto 18px; border-radius: 50%; color: var(--purple); background: var(--purple-soft); font-size: 47px; }
.empty-card h2 { margin: 0 0 10px; font-size: clamp(25px, 5vw, 34px); }
.empty-card p { margin: 0; color: var(--muted); font-size: 17px; }
.dashboard-summary-card { margin-top: clamp(24px,5vw,48px); padding: clamp(18px,3vw,30px); border: 1px solid rgba(92,90,167,.12); border-radius: 30px; background: #fff; box-shadow: 0 15px 50px rgba(38,40,62,.07); }
.dashboard-empty-state { min-height: 360px; display: grid; place-items: center; padding: 34px 20px; text-align: center; }
.dashboard-empty-state[hidden] { display: none; }
.dashboard-empty-state .eyebrow { margin: 0 0 7px; color: var(--purple); font-size: 11px; font-weight: 900; letter-spacing: .1em; }
.dashboard-empty-state h2 { margin: 0 0 10px; font-size: clamp(25px,5vw,34px); }
.dashboard-empty-state p:not(.eyebrow) { max-width: 570px; margin: 0 auto 24px; color: var(--muted); font-size: 17px; line-height: 1.55; }
.dashboard-empty-state .button { width: auto; min-width: 190px; }
.dashboard-summary-heading { display: flex; align-items: start; justify-content: space-between; gap: 18px; margin-bottom: 20px; }
.dashboard-summary-heading .eyebrow { margin: 0 0 5px; color: var(--purple); font-size: 11px; font-weight: 900; letter-spacing: .1em; }
.dashboard-summary-heading h2 { margin: 0 0 7px; font-size: clamp(25px,4vw,34px); }
.dashboard-summary-heading p:last-child { max-width: 720px; margin: 0; color: var(--muted); line-height: 1.5; }
.dashboard-chart-card { margin: 0 0 24px; padding: clamp(16px,2.5vw,24px); overflow: hidden; border: 1px solid rgba(92,90,167,.14); border-radius: 22px; background: linear-gradient(145deg,#fbfaff,#f4f1fb); }
.dashboard-chart-heading { display: flex; align-items: start; justify-content: space-between; gap: 18px; margin-bottom: 14px; }
.dashboard-chart-heading h3 { margin: 0; color: var(--ink); font-size: clamp(19px,3vw,24px); }
.dashboard-chart-heading p { max-width: 590px; margin: 2px 0 0; color: var(--muted); font-size: 14px; line-height: 1.45; }
#dashboard-chart:empty { display: none; }
.dashboard-chart-scroll { width: 100%; overflow-x: auto; overscroll-behavior-inline: contain; -webkit-overflow-scrolling: touch; }
.dashboard-expense-chart { width: 100%; min-width: 720px; height: auto; display: block; overflow: visible; font-family: inherit; }
.dashboard-expense-chart .chart-grid-line { stroke: #ddd9e9; stroke-width: 1; }
.dashboard-expense-chart .chart-axis-label { fill: #74758a; font-size: 11px; font-weight: 700; }
.dashboard-expense-chart .chart-month-label { fill: var(--ink); font-size: 13px; font-weight: 800; }
.dashboard-expense-chart .chart-total-label { fill: var(--ink); font-size: 12px; font-weight: 900; paint-order: stroke; stroke: #f8f6fc; stroke-width: 4px; stroke-linejoin: round; }
.dashboard-expense-chart .chart-income-label { fill: #257c55; }
.dashboard-expense-chart rect { transition: opacity .16s ease; }
.dashboard-expense-chart rect:hover { opacity: .8; }
.dashboard-chart-legend { display: flex; flex-wrap: wrap; gap: 9px 16px; margin-top: 12px; padding-top: 15px; border-top: 1px solid rgba(92,90,167,.12); }
.dashboard-chart-legend span { display: inline-flex; align-items: center; gap: 7px; color: var(--ink); font-size: 12px; font-weight: 750; }
.dashboard-chart-legend i { width: 11px; height: 11px; flex: 0 0 auto; display: inline-block; border-radius: 3px; box-shadow: inset 0 0 0 1px rgba(20,21,35,.08); }
.dashboard-table-scroll { position: relative; isolation: isolate; border-radius: 20px; }
.dashboard-expense-table { width: max-content; border-collapse: separate; border-spacing: 0; table-layout: auto; font-size: 14px; font-variant-numeric: tabular-nums; }
.dashboard-expense-table th, .dashboard-expense-table td { width: auto; min-width: 0; padding: 13px 14px; border-bottom: 1px solid #e7e3ef; text-align: right; white-space: nowrap; }
.dashboard-expense-table th:not(:first-child), .dashboard-expense-table td:not(:first-child) { width: 1%; }
.dashboard-expense-table th:first-child { position: sticky; left: 0; z-index: 2; width: 1%; min-width: max-content; max-width: none; background: inherit; text-align: left; box-shadow: 5px 0 8px -8px rgba(38,40,62,.5); }
.dashboard-expense-table thead { color: #fff; background: var(--purple); }
.dashboard-expense-table thead th { border-bottom: 0; }
.dashboard-expense-table thead th:first-child { z-index: 4; background: var(--purple); }
.dashboard-expense-table thead strong, .dashboard-expense-table thead small { display: block; }
.dashboard-expense-table thead small { margin-top: 4px; color: #e6e3ff; font-size: 10px; font-weight: 600; }
.dashboard-expense-table .dashboard-period-range span { display: block; line-height: 1.25; }
.dashboard-expense-table tbody tr:nth-child(even) { background: #f8f6fc; }
.dashboard-expense-table tbody th { color: var(--ink); font-weight: 800; }
.dashboard-expense-table tbody tr:nth-child(odd) th { background: #fff; }
.dashboard-expense-table tbody tr:nth-child(even) th { background: #f8f6fc; }
.dashboard-expense-table tbody tr.dashboard-income-row { color: #2d7b62; background: #eef9f4; }
.dashboard-expense-table .dashboard-income-row th { color: #2d7b62; background: #eef9f4; }
.dashboard-expense-table tbody tr.dashboard-expense-total-row { color: #fff; background: #5c5aa7; font-weight: 900; }
.dashboard-expense-table .dashboard-expense-total-row th { color: #fff; background: #5c5aa7; }
.dashboard-expense-table tbody tr.dashboard-total-row { color: #fff; background: #27283e; font-size: 15px; font-weight: 900; }
.dashboard-expense-table .dashboard-total-row th { color: #fff; background: #27283e; }

.profile-card { width: min(100%, 700px); }
.signed-form-page { display: block; }
.signed-header-wrap { width: min(100%, 1000px); margin: 0 auto 14px; }
.signed-form-page > .form-card { margin-left: auto; margin-right: auto; }
.profile-head { display: grid; justify-items: center; margin-bottom: 24px; }
.profile-avatar { width: 140px; height: 140px; object-fit: cover; }
.details-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.detail { padding: 17px 18px; border: 1px solid rgba(92,90,167,.12); border-radius: 17px; background: #fbfaff; }
.detail dt { margin: 0 0 5px; color: var(--purple); font-size: 11px; font-weight: 900; letter-spacing: .09em; text-transform: uppercase; }
.detail dd { margin: 0; font-size: 17px; font-weight: 700; }
.admin-download-zone { margin-top: 30px; padding: 22px; border: 1px solid rgba(92,90,167,.16); border-radius: 20px; background: linear-gradient(145deg,#fbfaff,#f1effb); }
.admin-download-zone .eyebrow { margin: 0 0 6px; color: var(--purple); font-size: 11px; font-weight: 900; letter-spacing: .09em; }
.admin-download-zone h2 { margin: 0 0 7px; font-size: 20px; }
.admin-download-zone p:not(.eyebrow) { margin: 0 0 17px; color: var(--muted); line-height: 1.5; }
.danger-zone { margin-top: 30px; padding-top: 25px; border-top: 1px solid var(--line); }
.danger-zone h2 { margin: 0 0 7px; font-size: 20px; }
.danger-zone p { margin: 0 0 17px; color: var(--muted); line-height: 1.5; }

.expense-page-card { width: min(100%, 1100px); }
.expense-section { margin-top: 24px; padding: clamp(18px,3vw,28px); border: 1px solid rgba(92,90,167,.13); border-radius: 24px; background: #fbfaff; }
.section-heading { display: flex; align-items: start; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.section-heading h2 { margin: 0 0 5px; font-size: 23px; }
.section-heading p { margin: 0; color: var(--muted); line-height: 1.5; }
.edited-label { flex: 0 0 auto; color: var(--purple); font-size: 12px; font-weight: 800; }
.setup-section { background: linear-gradient(145deg,#fbfaff,#f2efff); }
.initial-form { display: grid; grid-template-columns: minmax(180px,1fr) minmax(190px,1fr) auto; align-items: end; gap: 14px; }
.compact-form { display: grid; grid-template-columns: minmax(150px,1fr) minmax(170px,1fr) minmax(160px,1fr) auto; align-items: end; gap: 14px; }
.meter-form { display: grid; grid-template-columns: minmax(180px,1fr) minmax(190px,1fr) auto; align-items: end; gap: 14px; }
.shopping-form { display: grid; grid-template-columns: repeat(4,minmax(130px,1fr)); align-items: end; gap: 14px; }
.shopping-form .field-wide { grid-column: span 2; }
.initial-form .field, .compact-form .field, .meter-form .field, .shopping-form .field { gap: 6px; }
.initial-form .field input, .compact-form .field input, .meter-form .field input, .shopping-form .field input { min-height: 52px; }
.initial-form .calendar-button, .compact-form .calendar-button, .meter-form .calendar-button, .shopping-form .calendar-button { min-height: 52px; }
.initial-form .button, .compact-form .button, .meter-form .button, .shopping-form .button { min-height: 52px; margin-bottom: 0; }
.table-scroll { width: 100%; overflow-x: auto; border: 1px solid var(--line); border-radius: 16px; background: #fff; -webkit-overflow-scrolling: touch; }
.expense-table { width: 100%; min-width: 1000px; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.expense-table th { position: sticky; top: 0; padding: 12px 10px; color: #fff; background: var(--purple); text-align: right; white-space: nowrap; }
.expense-table th:first-child, .expense-table td:first-child, .expense-table th:nth-child(2), .expense-table td:nth-child(2) { text-align: left; }
.expense-table td { padding: 11px 10px; border-top: 1px solid #e4e0ee; color: var(--ink); text-align: right; white-space: nowrap; }
.expense-table tbody tr:nth-child(even) { background: #f3f0fb; }
.expense-table tbody tr:hover { background: #ece8f8; }
.expense-table .empty-table { padding: 28px; color: var(--muted); text-align: center; }
.rate-history-table { min-width: 720px; }
.monthly-expense-table { min-width: 720px; }
.monthly-expense-table th, .monthly-expense-table td { text-align: left; }
.monthly-expense-table th:nth-child(3), .monthly-expense-table td:nth-child(3) { text-align: right; }
.monthly-expense-table .monthly-income-row { color: #257c55; background: #eef9f4; font-weight: 700; }
.monthly-expense-table .monthly-income-row:hover { background: #e2f4eb; }
.update-now-button { min-width: 105px; padding: 9px 13px; border: 0; border-radius: 999px; color: #fff; background: var(--purple); font-size: 13px; font-weight: 800; white-space: nowrap; }
.monthly-dialog .sheet-card { text-align: left; }
.monthly-dialog .dialog-mark, .monthly-dialog h2, .monthly-dialog .sheet-card > p { text-align: center; }
.monthly-dialog .dialog-mark { text-align: center; }
.address-selection-dialog { width: min(calc(100% - 28px), 620px); }
.address-selection-card { text-align: left; }
.address-selection-card h2, .address-selection-card > p { text-align: left; }
.address-selection-list { width: 100%; min-height: 270px; padding: 7px 10px; border: 1.5px solid var(--line); border-radius: 12px; color: var(--ink); background: #fff; font-size: 16px; line-height: 1.45; }
.address-selection-list option { padding: 5px 7px; }
.address-selection-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.address-selection-actions .button { min-width: 110px; min-height: 48px; }

dialog { border: 0; padding: 0; color: var(--ink); }
dialog::backdrop { background: rgba(21,22,35,.64); backdrop-filter: blur(4px); }
.sheet-dialog { width: min(calc(100% - 28px), 500px); border-radius: 28px; background: transparent; }
.sheet-card { position: relative; display: grid; padding: 34px; border-radius: 28px; background: #fff; text-align: center; }
.sheet-card h2 { margin: 10px 0 7px; font-size: 27px; }
.sheet-card > p { margin: 0 0 23px; color: var(--muted); line-height: 1.5; }
.dialog-mark { width: 68px; height: 68px; display: grid; place-items: center; justify-self: center; border-radius: 50%; color: var(--purple); background: var(--purple-soft); font-size: 36px; }
.dialog-close { position: absolute; top: 15px; right: 15px; width: 40px; height: 40px; border: 0; border-radius: 50%; color: var(--muted); background: #f2f0f7; font-size: 25px; }
.button-note { margin: -6px 0 14px; color: var(--muted); font-size: 12px; }

.crop-dialog { width: 100vw; max-width: none; height: 100vh; max-height: none; background: #14141a; }
.crop-shell { min-height: 100%; display: grid; grid-template-rows: auto minmax(260px,1fr) auto; color: #fff; background: #14141a; }
.crop-shell header { position: relative; z-index: 4; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: max(12px,env(safe-area-inset-top)) max(14px,env(safe-area-inset-right)) 10px max(16px,env(safe-area-inset-left)); background:#1f1f27; }
.crop-heading { min-width: 0; }
.crop-shell h2 { margin: 0 0 4px; }
.crop-shell header p { margin: 0; color: #c8c8d0; }
.crop-header-actions { flex: 0 0 auto; display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.crop-top-action { min-height: 44px; padding: 8px 16px; border: 1px solid transparent; border-radius: 999px; color: #fff; font-size: 14px; font-weight: 800; white-space: nowrap; }
.crop-top-secondary { border-color: #777784; background: #4d4d58; }
.crop-top-primary { background: #8b84f5; box-shadow: 0 7px 18px rgba(139,132,245,.24); }
.crop-close { width: 44px; height: 44px; flex: 0 0 auto; border: 0; border-radius: 50%; color: #fff; background: #3f3f48; font-size: 27px; }
.crop-stage { position: relative; min-height: 280px; overflow: hidden; touch-action: none; }
.crop-stage canvas { width: 100%; height: 100%; display: block; }
.crop-ring { position: absolute; width: min(72vw, 58vh); aspect-ratio: 1; left: 50%; top: 50%; transform: translate(-50%,-50%); border: 3px solid #fff; border-radius: 50%; box-shadow: 0 0 0 100vmax rgba(0,0,0,.52); pointer-events: none; }
.zoom-control { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 14px; padding: 16px max(24px,calc((100vw - 720px)/2)); color: #dddde4; }
.zoom-control input { width: 100%; accent-color: #9b97ed; }

.toast-region { position: fixed; z-index: 100; left: 50%; bottom: max(22px,env(safe-area-inset-bottom)); width: min(calc(100% - 30px), 440px); transform: translateX(-50%); pointer-events: none; }
.toast { padding: 14px 18px; border-radius: 16px; color: #fff; background: #26283e; box-shadow: 0 12px 35px rgba(0,0,0,.25); text-align: center; animation: toast-in .22s ease both; }
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px); } }

@media (max-width: 760px) {
  .postcode-lookup-row { grid-template-columns: 1fr; }
  .postcode-lookup-button { width: 100%; }
  .page-shell { padding: 0; }
  .welcome-card { min-height: 100dvh; grid-template-columns: 1fr; border: 0; border-radius: 0; box-shadow: none; }
  .welcome-art { min-height: 42dvh; padding: 30px 28px 10px; }
  .family-illustration { width: min(76vw, 350px); }
  .welcome-art::before { width: 330px; height: 330px; }
  .welcome-art::after { width: 440px; height: 440px; }
  .welcome-copy { min-height: 58dvh; padding: 34px 28px max(34px,env(safe-area-inset-bottom)); }
  .welcome-copy h1 { font-size: clamp(41px, 13vw, 58px); }
  .welcome-copy .lead { margin: 17px 0 26px; }
  .welcome-actions { max-width: none; }
  .form-page { display: block; padding: 0; }
  .form-card { min-height: 100dvh; margin: 0; padding: max(24px,env(safe-area-inset-top)) 22px max(80px,calc(env(safe-area-inset-bottom) + 34px)); border: 0; border-radius: 0; box-shadow: none; }
  .details-grid { grid-template-columns: 1fr; }
  .profile-shortcut span { display: none; }
  .topbar { grid-template-columns: 54px minmax(0,1fr) 54px; }
  .sheet-card { padding: 31px 22px 25px; }
  .address-selection-actions { flex-direction: row-reverse; }
  .address-selection-actions .button { flex: 1; min-width: 0; }
  .signed-form-page { padding: max(18px,env(safe-area-inset-top)) 20px 40px; }
  .signed-form-page > .form-card { min-height: 0; padding: 28px 22px max(42px,env(safe-area-inset-bottom)); border: 1px solid rgba(92,90,167,.12); border-radius: 28px; box-shadow: 0 18px 55px rgba(38,40,62,.08); }
  .crop-shell header { gap: 8px; padding-left: 12px; padding-right: 10px; }
  .crop-shell h2 { font-size: 18px; }
  .crop-shell header p { display: none; }
  .crop-top-action { min-height: 42px; padding: 7px 12px; font-size: 13px; }
  .crop-close { width: 42px; height: 42px; }
  .expense-section { padding: 17px; border-radius: 20px; }
  .dashboard-page { padding-left: 14px; padding-right: 14px; }
  .dashboard-summary-card { padding: 17px; border-radius: 22px; }
  .dashboard-summary-heading { display: block; }
  .dashboard-summary-heading .text-button { margin-top: 6px; padding-left: 0; }
  .dashboard-chart-card { margin-left: -2px; margin-right: -2px; padding: 15px 12px; border-radius: 18px; }
  .dashboard-chart-heading { display: block; padding: 0 3px; }
  .dashboard-chart-heading p { margin-top: 6px; }
  .dashboard-expense-chart { min-width: 680px; }
  .dashboard-chart-legend { padding-left: 3px; padding-right: 3px; }
  .dashboard-expense-table { font-size: 13px; }
  .section-heading { display: block; }
  .edited-label { display: block; margin-top: 8px; }
  .initial-form, .compact-form, .meter-form, .shopping-form { grid-template-columns: 1fr; }
  .shopping-form .field-wide { grid-column: auto; }
  .expense-table { min-width: 940px; }
}

@media (max-width: 350px) {
  .crop-heading { display: none; }
  .crop-shell header { justify-content: flex-end; }
}

@media (max-height: 650px) and (orientation: landscape) {
  .welcome-card { min-height: calc(100dvh - 24px); }
  .welcome-art { padding: 25px; }
  .welcome-copy { padding: 28px 38px; }
  .welcome-copy h1 { font-size: 46px; }
  .welcome-copy .lead { margin: 14px 0 20px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
.expense-active-field { display:flex; align-items:center; gap:10px; margin:4px 0 18px; color:#171936; font-weight:700; }
.expense-active-field input { width:22px; height:22px; accent-color:#514ba0; }
