:root { color-scheme: light; }
html, body { width: 100%; height: 100%; max-width: 100%; overflow: hidden; overscroll-behavior: none; }
body { position: fixed; inset: 0; -webkit-text-size-adjust: 100%; touch-action: manipulation; }
.app { width: 100%; height: 100dvh; min-width: 0; min-height: 0; grid-template-rows: auto minmax(0, 1fr) auto; contain: layout paint; }
.content { width: 100%; min-width: 0; min-height: 0; overflow-x: hidden; overflow-y: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.content::-webkit-scrollbar, .chips::-webkit-scrollbar, #sheetBody::-webkit-scrollbar { display: none; }
.content > *, .grid > *, .list > *, .row > *, .sheet-head > * { min-width: 0; max-width: 100%; }
.list { width: 100%; min-width: 0; }
.list > .row, .list > button, button.row { width: 100%; min-width: 0; max-width: 100%; text-align: left; }
.row-main { overflow: hidden; }
.row-main b, .row-main small { max-width: 100%; }
.row button { flex: 0 0 auto; }
.money, .badge { max-width: 42%; overflow: hidden; text-overflow: ellipsis; }
button, input, select, textarea { font: inherit; }
button, [role="button"], input, select { min-height: 44px; }
.offline-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 30; width: 100%;
  min-height: calc(32px + env(safe-area-inset-top)); padding: calc(7px + env(safe-area-inset-top)) 12px 7px;
  border: 0; border-radius: 0; background: #b6463a; color: #fff; text-align: center;
}
dialog { box-sizing: border-box; width: min(620px, 100vw); max-width: 100vw; height: auto; max-height: calc(100dvh - env(safe-area-inset-top)); margin: auto auto 0; padding-bottom: max(18px, env(safe-area-inset-bottom)); overflow: hidden; }
dialog[open] { display: grid; grid-template-rows: auto minmax(0, 1fr); animation: sheet-in .24s cubic-bezier(.2,.8,.2,1); }
dialog[open]::backdrop { animation: backdrop-in .2s ease-out; }
#sheetBody { min-width: 0; min-height: 0; max-width: 100%; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
#sheetBody form, #sheetBody .card, #sheetBody .list { max-width: 100%; min-width: 0; }
dialog form > .primary:last-child { position: sticky; bottom: 0; z-index: 2; width: 100%; margin-top: 14px; box-shadow: 0 -10px 18px var(--surface); }
header, nav { flex: 0 0 auto; }
nav button, .row, .card, .chip, .primary, .secondary, .icon-btn { -webkit-tap-highlight-color: transparent; transition: transform .16s ease, background-color .2s ease, border-color .2s ease, color .2s ease, opacity .2s ease, box-shadow .2s ease; }
button:active, .row:active, .card:active { transform: scale(.985); }
nav button.active { transform: translateY(-1px); }
@keyframes sheet-in { from { transform: translateY(24px); opacity: .72; } to { transform: translateY(0); opacity: 1; } }
@keyframes backdrop-in { from { opacity: 0; } to { opacity: 1; } }
@media (max-width: 370px) {
  .content { padding-inline: 12px; }
  header { padding-inline: 16px; }
  .hero { padding: 17px; }
  .hero .amount { font-size: 30px; }
  .card { padding: 13px; }
  .row { gap: 9px; padding: 12px; }
}
html[data-density="COMPACT"] .row { padding-block: 9px; }
html[data-density="COMPACT"] .card { padding: 12px; }
html[data-theme="DARK"] { color-scheme: dark; }
html[data-theme="DARK"] body { --bg:#171310; --surface:#241e1a; --text:#f6eee5; --muted:#bbaea2; --line:#40362f; background:#171310; color:#f6eee5; }
html[data-theme="DARK"] input, html[data-theme="DARK"] select, html[data-theme="DARK"] textarea, html[data-theme="DARK"] dialog { background:#241e1a; color:#f6eee5; }
@media (prefers-color-scheme: dark) {
  html[data-theme="SYSTEM"] { color-scheme: dark; }
  html[data-theme="SYSTEM"] body { --bg:#171310; --surface:#241e1a; --text:#f6eee5; --muted:#bbaea2; --line:#40362f; background:#171310; color:#f6eee5; }
  html[data-theme="SYSTEM"] input, html[data-theme="SYSTEM"] select, html[data-theme="SYSTEM"] textarea, html[data-theme="SYSTEM"] dialog { background:#241e1a; color:#f6eee5; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
