/* Phone layout. Loaded for screens up to 640px, and by base.html also when Chrome shows a phone the desktop site
   (980px wide): then the page is zoomed back to the phone's real width. */
body { font-size: 18px; padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
body.editing { padding-bottom: 0; }
main { padding: 12px 12px 24px; }
nav.top { padding: 12px 16px; }
nav.top > a:not(.brand) { display: none; }
nav.top .brand { font-size: 1.1rem; }
a.back { display: flex; align-items: center; min-height: 48px; margin: -4px 0 4px; font-size: 1.05rem; }

nav.tabbar { display: grid; grid-template-columns: repeat(3, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 3;
             background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
body.editing nav.tabbar { display: none; }
nav.tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
               min-height: 72px; color: var(--muted); text-decoration: none; font-size: .8rem; }
nav.tabbar svg { width: 30px; height: 30px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
nav.tabbar a.active { color: var(--accent); font-weight: 600; }
nav.tabbar a.add svg { width: 46px; height: 46px; padding: 8px; border-radius: 50%; background: var(--accent); color: var(--accent-text); stroke: var(--accent-text); }

.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 56px; padding: 14px 22px;
       font-size: 1.1rem; border-radius: 12px; }
input, select { min-height: 54px; padding: 12px 14px; font-size: 18px; border-radius: 10px; }
input[type=checkbox] { min-height: 0; width: 24px; height: 24px; }
label { font-size: .95rem; }
label.check { min-height: 48px; }
summary { min-height: 48px; display: flex; align-items: center; }
.grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.grid > label:first-child { grid-column: 1 / -1; }
.card.narrow { margin: 32px auto; }
.card.narrow .btn { width: 100%; margin-top: 12px; }
.card { padding: 14px; }
.actual-bar form, .actual-bar .btn { width: 100%; }
.row.pick { display: grid; grid-template-columns: 1fr; }
.row.pick .btn { min-height: 72px; font-size: 1.2rem; }
.row .btn { flex: 1; }
.add-row { display: flex; flex-direction: column; gap: 8px; align-items: stretch; }
.row.actions { position: sticky; bottom: 0; z-index: 2; margin: 16px -14px -14px; padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
               background: var(--card); border-top: 1px solid var(--line); border-radius: 0 0 12px 12px; flex-wrap: nowrap; }
.row.actions .btn { min-height: 60px; font-size: 1.15rem; }
.row.actions .btn.primary { flex: 2; }
.danger-zone .btn { width: 100%; }

.summary { gap: 8px; }
.summary div { padding: 10px; }
.summary strong { font-size: 1rem; }
.filters { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.filters input[type=search], .filters select, .filters .btn { grid-column: 1 / -1; width: 100%; }
.filters label { flex-direction: column; align-items: stretch; }
.receipts a { grid-template-columns: 1fr auto; grid-template-areas: "who sum" "date sum"; gap: 2px 12px;
              padding: 14px 16px; min-height: 68px; align-items: center; }
.receipts .who { grid-area: who; font-size: 1.05rem; }
.receipts .date { grid-area: date; }
.receipts .sum { grid-area: sum; font-size: 1.1rem; }
.tag { font-size: .8rem; padding: 2px 8px; }

.tabs { display: grid; grid-template-columns: repeat(3, 1fr); }
.tab { min-height: 48px; font-size: 1rem; }
.two { grid-template-columns: 1fr; }
table.data td { padding: 10px 4px; }
table.data select { min-height: 44px; }
.thumbs { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
.thumb > button { width: 44px; height: 44px; top: 0; right: 0; font-size: 1.3rem; background: var(--card); border-radius: 0 0 0 10px; }
.thumb .drop { min-height: 44px; }

table.items thead { display: none; }
table.items tr { display: grid; grid-template-columns: 1fr 1fr 1fr 64px 48px; gap: 6px; padding: 10px 0; border-top: 1px solid var(--line); }
table.items td:nth-child(1), table.items td:nth-child(2) { grid-column: 1 / -1; width: auto; }
table.items input, table.items select { padding: 10px; }
table.items .del { width: 48px; height: 50px; font-size: 1.3rem; color: var(--danger); }
