/* v13 shared layout contracts. Loaded after legacy component styles. */
:root{--touch:44px;--space:12px;--card-pad:16px;--muted:#626a80;--green:#137d59;--red:#c0394a;--primary-2:#6755e8;--safe-bottom:env(safe-area-inset-bottom,0px);--viewport-height:100dvh}
html{word-break:keep-all;overflow-wrap:break-word;scroll-padding-bottom:110px}
body{line-height:1.5}
button,a,.segment,.month-pill,.text-button,.small-link,.mini-btn{word-break:keep-all;line-height:1.4}
button{min-height:var(--touch);flex-shrink:0}
button{min-width:44px}
button:disabled{cursor:wait;opacity:.65}
button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible,[tabindex]:focus-visible{outline:3px solid #5144cd;outline-offset:3px}
input,select{font-size:16px;min-width:0;max-width:100%}
.view,.card,.section,.metric-card,.home-two>*{min-width:0}
.section-head{align-items:flex-start;gap:12px;flex-wrap:wrap}
.section-head>div{flex:1 1 170px;min-width:0}
.section-head>button{white-space:nowrap;padding:10px 12px;min-width:88px}
.section-sub,.modal-subtitle,.tx-meta,.settings-note,.pace-copy p{line-height:1.65;text-wrap:pretty}
.section-sub,.metric-label,.metric-foot,.field em,.segment,.pace-note,.trusted-reset-note span,.vault-status small{color:var(--muted)}
.month-row{flex-wrap:wrap}.month-row h2{white-space:nowrap}
.month-controls button{width:44px;height:44px}.month-controls{gap:5px}
.account-button{min-width:44px;height:44px}.account-copy,.account-row>div{min-width:0}.account-copy b{overflow-wrap:anywhere}
.hero-amount{font-size:clamp(27px,7vw,48px);line-height:1.2;white-space:nowrap;font-variant-numeric:tabular-nums;letter-spacing:-1px}
.hero-meta{flex-wrap:wrap;gap:6px 12px}.hero-meta span{white-space:nowrap}
.metric-value{font-size:clamp(16px,4.1vw,26px);line-height:1.3;font-variant-numeric:tabular-nums;white-space:nowrap;letter-spacing:-.7px}
.metric-foot{line-height:1.5;overflow-wrap:break-word}
.budget-item{grid-template-columns:38px minmax(0,1fr);gap:8px 10px;align-items:start}
.budget-item>div:nth-child(2){min-width:0}.budget-item>b{grid-column:2;text-align:right;white-space:nowrap;font-size:12px}
.budget-name{overflow-wrap:anywhere;text-wrap:pretty}.budget-numbers{display:flex;flex-wrap:wrap;gap:0 5px;line-height:1.65}
.budget-numbers .money{white-space:nowrap}.budget-item .progress{margin-top:8px}
.tx-row{grid-template-columns:38px minmax(0,1fr);gap:8px 10px;position:relative}
.tx-row>div:nth-child(2){min-width:0}.tx-row>div:last-child{grid-column:2;display:flex;align-items:center;justify-content:space-between;gap:8px;flex-wrap:wrap}
.tx-title{white-space:normal;overflow-wrap:anywhere;text-wrap:pretty}.tx-meta{overflow-wrap:anywhere}
.tx-amount{font-size:15px;font-variant-numeric:tabular-nums;white-space:nowrap}.tx-actions{margin:0}.delete-tx-btn,.mini-btn{min-width:44px;min-height:44px}
.bottom-nav{height:calc(78px + var(--safe-bottom));padding:6px max(8px,env(safe-area-inset-right)) calc(6px + var(--safe-bottom)) max(8px,env(safe-area-inset-left));display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:4px;justify-items:center}
.nav-item{width:100%;min-width:44px;height:58px;color:#626a80}.nav-item small{font-size:11px;font-weight:700;white-space:nowrap}.nav-add{width:52px;height:52px;transform:translateY(-6px);border-radius:18px}
.app-shell{padding-bottom:calc(106px + var(--safe-bottom))}
.bottom-sheet{max-height:calc(var(--viewport-height) - 12px);scroll-padding:72px 0 24px;overscroll-behavior:contain}
.bottom-sheet .sheet-head{position:sticky;top:-10px;background:#fff;z-index:2;padding:10px 0;border-bottom:1px solid var(--line)}
.sheet-head>div,.sheet-head h2{min-width:0}.sheet-head h2{font-size:21px;text-wrap:pretty}.icon-button{min-width:44px;min-height:44px;padding:6px}
.modal{padding:12px;max-height:var(--viewport-height);overscroll-behavior:contain}
.modal-card{max-height:calc(var(--viewport-height) - 24px);min-width:0;overscroll-behavior:contain;scroll-padding:16px}
.auth-overlay{max-height:var(--viewport-height);align-items:safe center;padding:16px}
.auth-card{min-width:0}.auth-card h1{text-wrap:pretty}.auth-footnote{color:var(--muted);font-size:12px}
.auth-error{color:#a92c3c;line-height:1.6}.auth-link-button{padding:10px}
.trust-device-check input{width:18px;height:18px;flex:0 0 18px}.trust-device-check,.delete-confirm-check{min-height:44px}
.sheet-form{gap:16px}.field-title-row{gap:8px;flex-wrap:wrap}.field-label{color:var(--muted)}
.bottom-sheet .category-grid{grid-template-columns:repeat(3,minmax(0,1fr))}
.bottom-sheet .category-chip{overflow-wrap:normal;word-break:keep-all;min-height:80px;font-size:12px}
.category-chip .category-label{display:block;width:100%;height:auto;background:transparent;border-radius:0;font:inherit;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.recent-templates{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));overflow:visible;gap:8px}
.recent-template{min-width:0;width:100%;padding:10px 8px}.recent-template small{white-space:nowrap;font-variant-numeric:tabular-nums}
.amount-field input{font-size:clamp(24px,6vw,34px)}
.budget-edit-row{grid-template-columns:38px minmax(0,1fr);align-items:start}.budget-edit-row input{grid-column:2;min-height:48px;font-size:16px}
.budget-total{gap:12px;flex-wrap:wrap}.budget-total span:last-child{white-space:nowrap}
.recurring-stats span{white-space:nowrap}.recurring-right b{font-variant-numeric:tabular-nums}.recurring-row{min-width:0}
.category-manage-row{grid-template-columns:38px minmax(0,1fr)}.category-manage-row .actions{grid-column:2;flex-wrap:wrap}.category-manage-row .actions button{min-width:52px}
.icon-picker{grid-template-columns:repeat(auto-fit,minmax(44px,1fr))}.icon-option{min-width:44px;min-height:44px}.color-option{width:44px;height:44px}
.calendar-day,.calendar-day-blank{min-height:44px;aspect-ratio:auto}.transaction-calendar-grid,.calendar-weekdays{gap:2px}
.date-jump-card{overflow-y:auto}.date-jump-toolbar{grid-template-columns:44px minmax(0,1fr) 44px;gap:4px}.calendar-nav-button{width:44px;height:44px}.calendar-select-wrap select{height:44px}
.date-jump-footer{flex-wrap:wrap}.date-jump-footer>span{text-align:left;font-size:12px;max-width:none}
.composition-card .donut-wrap{grid-template-columns:1fr;gap:16px}.composition-card .legend{justify-self:center;max-width:100%;width:100%}.legend-name span{white-space:normal;overflow-wrap:anywhere}.legend-dot{flex:0 0 9px}
.toast{white-space:normal;word-break:keep-all;width:max-content;max-width:calc(100vw - 32px);bottom:calc(100px + var(--safe-bottom));line-height:1.6}
.policy-link{display:block;text-align:center;padding:12px;color:#5144cd;min-height:44px;font-size:13px}
.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}
.sync-status{margin:0 14px 8px;padding:10px 12px;border:1px solid #d8d3ff;border-radius:12px;background:#f0efff;color:#433985;font-size:12px}
@media(max-width:359px){.main{padding-left:12px;padding-right:12px}.metric-card{padding:12px 10px}.metric-grid{gap:8px}.month-row{gap:8px}.hero-card{padding:18px}.bottom-sheet .category-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.auth-card{padding:18px}.auth-overlay{padding:12px}.modal-card{padding:16px}.date-jump-card{padding:16px 8px}.recent-templates{grid-template-columns:1fr}.date-jump-modal{padding:0}.calendar-day{min-width:0}}
@media(min-width:720px){.budget-edit-row{grid-template-columns:42px minmax(0,1fr) 180px}.budget-edit-row input{grid-column:auto}.bottom-sheet .category-grid{grid-template-columns:repeat(4,minmax(0,1fr))}.tx-row{grid-template-columns:38px minmax(0,1fr)}.metric-value{font-size:25px}.recent-templates{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(min-width:900px){.bottom-nav{height:78px;padding:7px 16px}.app-shell{padding-bottom:118px}}
@media(prefers-reduced-motion:reduce){*,*::before,*::after{animation:none!important;transition:none!important;scroll-behavior:auto!important}}
@media(max-width:359px){.date-jump-card{padding-left:6px;padding-right:6px}.transaction-calendar-grid,.calendar-weekdays{gap:0}}
@media(min-width:900px){.composition-card .donut-wrap{grid-template-columns:minmax(230px,1fr) minmax(160px,1fr);gap:24px}.composition-card .legend{max-width:250px}}
@media(min-width:720px){.metric-value{font-size:clamp(20px,2vw,25px)}}
.modal,.auth-overlay{top:var(--viewport-offset,0px);height:var(--viewport-height);bottom:auto}
@media(max-width:719px){.bottom-sheet{bottom:var(--keyboard-inset,0px)}.topbar{height:calc(66px + env(safe-area-inset-top,0px));padding-top:calc(13px + env(safe-area-inset-top,0px))}}
.tx-open-button{display:block;width:100%;border:0;background:transparent;color:inherit;text-align:left;padding:0;font-weight:780}
.tx-row:focus-within{outline:2px solid #5144cd;outline-offset:3px;border-radius:12px}

.sync-conflict-notice { position:fixed; top:4px; left:50%; transform:translateX(-50%); z-index:90; max-width:calc(100vw - 24px); white-space:normal; background:#fff3ce; color:#493300; }
#syncConflictModal .modal-card { width:min(560px,calc(100vw - 24px)); max-height:85dvh; overflow:auto; padding:20px; background:var(--surface,#fff); border-radius:20px; }
.sync-conflict-row { display:grid; gap:8px; margin:16px 0; overflow-wrap:anywhere; }
.sync-conflict-row button { white-space:normal; overflow-wrap:anywhere; min-width:0; height:auto; }

/* One chevron across browsers. Background artwork never intercepts pointer input. */
select,.field select,.filter-bar select,.calendar-select-wrap select{appearance:none;-webkit-appearance:none;padding-right:48px;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23626a80' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");background-position:right 18px center;background-size:14px;background-repeat:no-repeat}
.date-segments{display:grid;grid-template-columns:minmax(64px,1.5fr) 8px minmax(44px,1fr) 8px minmax(44px,1fr) 44px;align-items:center;gap:2px;border:1px solid var(--line);border-radius:14px;padding:2px 4px;background:#fff}
.field .date-segments>input{border:0;padding:0 2px;text-align:center;height:44px;border-radius:8px;font-variant-numeric:tabular-nums;min-width:0}
.date-segments>span{color:var(--muted);text-align:center}.date-calendar{position:relative;width:44px;height:44px;display:grid;place-items:center;border-left:1px solid var(--line);color:#5144cd;font-size:25px}
.date-calendar span{pointer-events:none}.field .date-calendar input{position:absolute;inset:0;width:44px;height:44px;opacity:0;padding:0;cursor:pointer}
.date-calendar:focus-within{outline:3px solid #5144cd;outline-offset:1px;border-radius:8px}
.field-error{color:#a92c3c;font-size:13px;line-height:1.6;margin:8px 0 0}
.transaction-date-row{grid-template-columns:1fr}
@media(min-width:600px){.transaction-date-row{grid-template-columns:minmax(260px,1fr) 1fr}}
.app-update{position:fixed;left:50%;transform:translateX(-50%);bottom:calc(100px + var(--safe-bottom));z-index:95;width:min(420px,calc(100vw - 24px));display:flex;align-items:center;justify-content:space-between;gap:12px;padding:12px;background:#f4f3ff;border:1px solid #c9c3ff;border-radius:16px;box-shadow:0 6px 24px #2222;font-size:14px}.app-update.hidden{display:none}
.category-manage-row{grid-template-columns:36px minmax(0,1fr) auto;gap:8px;padding:10px}.category-manage-row .actions{grid-column:auto;flex-wrap:nowrap;gap:4px}.category-manage-row .actions button{min-width:44px;font-size:12px;padding:6px}.category-manage-row.archived{opacity:1;background:#f7f8fc}.category-manage-row .budget-name{line-height:1.45}.category-manage-row .budget-numbers{font-size:11px}
