:root {
  color-scheme: light;
  --bg: #f4f6f9;
  --card: #fff;
  --text: #18202a;
  --muted: #667085;
  --line: #d9e0e8;
  --brand: #a62319;
  --brand-dark: #76150f;
  --brand-soft: #fff0ed;
  --green: #087a4b;
  --shadow: 0 18px 50px rgba(24, 32, 42, .09);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--text);
  background: radial-gradient(circle at top left, #ffe9e4 0, transparent 34rem), linear-gradient(180deg, #fbfbfd, var(--bg));
}

.shell { width: min(100% - 32px, 960px); margin: auto; padding: 42px 0 max(24px, env(safe-area-inset-bottom)); }
.brand { display: flex; align-items: center; gap: 18px; margin-bottom: 26px; }
.brand img { width: 78px; height: 78px; flex: 0 0 auto; object-fit: contain; border-radius: 22px; background: #fff; padding: 6px; box-shadow: var(--shadow); }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 10px; font-size: clamp(2rem, 6vw, 3.6rem); line-height: 1; }
h2 { margin-bottom: 5px; }
.eyebrow { margin-bottom: 7px; color: var(--brand); font-size: .78rem; font-weight: 850; letter-spacing: .13em; text-transform: uppercase; }
.subtitle, .section-heading p, .account-head p, .privacy { color: var(--muted); }
.card { background: rgba(255, 255, 255, .96); border: 1px solid rgba(217, 224, 232, .85); border-radius: 28px; padding: 28px; box-shadow: var(--shadow); }
.login-card { max-width: 560px; margin: auto; }
.section-heading { display: flex; align-items: center; gap: 14px; margin-bottom: 24px; }
.section-heading p { margin-bottom: 0; }
.icon { display: grid; place-items: center; width: 46px; height: 46px; flex: 0 0 46px; border-radius: 15px; background: var(--brand-soft); font-size: 1.35rem; }
form { display: grid; gap: 18px; }
label { display: grid; gap: 8px; font-weight: 750; }
input { width: 100%; min-height: 56px; border: 1px solid var(--line); border-radius: 16px; padding: 16px 17px; font: inherit; font-size: 1.08rem; outline: none; background: #fff; }
input:focus { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(166, 35, 25, .12); }
button { min-height: 52px; border: 0; border-radius: 16px; padding: 15px 18px; font: inherit; font-weight: 800; cursor: pointer; touch-action: manipulation; background: linear-gradient(135deg, var(--brand-dark), var(--brand)); color: #fff; }
button:disabled { opacity: .65; cursor: wait; }
.secondary { background: #fff; color: var(--brand); border: 1px solid var(--line); }
.privacy { margin: 18px 0 0; text-align: center; font-size: .84rem; }
.error { margin: 0; padding: 13px 15px; border-radius: 14px; background: var(--brand-soft); color: var(--brand-dark); font-weight: 700; }
.account-head { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 18px; }
.account-head h2 { font-size: 1.75rem; }
.account-head p:last-child { margin-bottom: 0; }
.data-status { display: flex; align-items: center; gap: 11px; margin: 0 0 16px; padding: 12px 15px; border: 1px solid #b7e2cc; border-radius: 16px; background: #edf9f3; color: var(--green); }
.data-status div { display: grid; gap: 2px; }
.data-status small { color: #44695a; }
.status-dot { width: 10px; height: 10px; flex: 0 0 10px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 5px rgba(8, 122, 75, .12); }
.summary-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 20px; }
.summary { display: grid; gap: 8px; min-width: 0; padding: 24px; border-radius: 24px; background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow); }
.summary span { color: var(--muted); font-weight: 700; }
.summary strong { font-size: clamp(1.7rem, 5vw, 2.55rem); overflow-wrap: anywhere; }
.summary small { color: var(--muted); }
.summary.open { background: linear-gradient(145deg, var(--brand-dark), var(--brand)); color: #fff; border: 0; }
.summary.open span, .summary.open small { color: #ffe3df; }
.summary.paid strong { color: var(--green); }
.entries { display: grid; gap: 10px; }
.entry { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 18px; padding: 16px; border: 1px solid var(--line); border-radius: 17px; background: #fff; }
.entry strong { overflow-wrap: anywhere; }
.entry .amount { grid-row: 1 / 3; grid-column: 2; align-self: center; font-size: 1.05rem; font-weight: 800; }
.entry small { color: var(--muted); line-height: 1.4; }
.entry .free { color: var(--green); }
.empty { padding: 30px; text-align: center; color: var(--muted); background: var(--bg); border-radius: 18px; }
footer { display: flex; justify-content: space-between; gap: 12px; padding: 28px 4px 0; color: var(--muted); font-size: .82rem; }
[hidden] { display: none !important; }

@media (max-width: 680px) {
  body { background: linear-gradient(180deg, #fff4f1 0, var(--bg) 320px); }
  .shell { width: 100%; padding: max(18px, env(safe-area-inset-top)) 14px max(22px, env(safe-area-inset-bottom)); }
  .brand { align-items: center; gap: 12px; margin: 0 4px 20px; }
  .brand img { width: 58px; height: 58px; border-radius: 18px; }
  .brand h1 { margin-bottom: 5px; font-size: clamp(1.65rem, 8vw, 2.1rem); line-height: 1.05; }
  .brand .eyebrow { margin-bottom: 4px; font-size: .68rem; }
  .brand .subtitle { margin: 0; font-size: .9rem; line-height: 1.35; }
  .card { padding: 20px 18px; border-radius: 23px; }
  .login-card { width: 100%; }
  .section-heading { gap: 12px; margin-bottom: 20px; }
  .section-heading h2 { font-size: 1.35rem; }
  .section-heading p { font-size: .9rem; line-height: 1.35; }
  .icon { width: 42px; height: 42px; flex-basis: 42px; border-radius: 14px; }
  form { gap: 16px; }
  input { min-height: 58px; padding: 15px 16px; font-size: 16px; }
  #login-button { width: 100%; min-height: 58px; margin-top: 2px; }
  .account-head { align-items: flex-start; gap: 10px; margin: 3px 4px 16px; }
  .account-head h2 { margin-bottom: 4px; font-size: 1.45rem; line-height: 1.1; }
  .account-head .eyebrow { margin-bottom: 5px; font-size: .68rem; }
  .account-head .secondary { min-height: 44px; padding: 10px 13px; border-radius: 14px; white-space: nowrap; }
  .data-status { margin-bottom: 12px; padding: 11px 13px; font-size: .86rem; }
  .data-status small { font-size: .76rem; line-height: 1.35; }
  .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
  .summary { gap: 5px; padding: 17px 15px; border-radius: 20px; box-shadow: 0 10px 28px rgba(24, 32, 42, .07); }
  .summary.open { grid-column: 1 / -1; padding: 20px; }
  .summary span { font-size: .82rem; }
  .summary strong { font-size: clamp(1.55rem, 8vw, 2.1rem); line-height: 1.05; }
  .summary small { font-size: .75rem; line-height: 1.3; }
  .entries-card { padding: 18px 14px; }
  .entries-card .section-heading { padding: 0 3px; }
  .entries { gap: 8px; }
  .entry { grid-template-columns: minmax(0, 1fr); gap: 5px; padding: 14px; border-radius: 16px; }
  .entry strong { font-size: .96rem; line-height: 1.3; }
  .entry .amount { grid-row: auto; grid-column: auto; justify-self: start; margin-top: 3px; font-size: 1rem; }
  .entry small { grid-row: 2; font-size: .78rem; }
  .empty { padding: 24px 14px; }
  footer { flex-direction: column; align-items: center; gap: 5px; padding-top: 22px; text-align: center; }
}

@media (max-width: 370px) {
  .shell { padding-left: 10px; padding-right: 10px; }
  .brand img { width: 50px; height: 50px; }
  .brand .subtitle { display: none; }
  .account-head { flex-wrap: wrap; }
  .account-head .secondary { width: 100%; }
  .summary-grid { grid-template-columns: 1fr; }
  .summary.open { grid-column: auto; }
}
