/* Four shared layouts. The 768px shop exception is the minimum space for two usable panes. */
:root{--app-layout:laptop;--visible-height:100dvh;--tab-height:76px}
@media(600px <= width < 1024px){:root{--app-layout:tablet}}
@media(width < 600px){:root{--app-layout:phone}}
@media(height < 500px) and (pointer:coarse){:root{--app-layout:phone-sideways}}
body{padding-left:env(safe-area-inset-left);padding-right:env(safe-area-inset-right);padding-top:env(safe-area-inset-top)}
.header-buttons .theme-toggle{position:relative}.install-icon{display:none}.top .brand{white-space:nowrap;text-wrap:nowrap}.top>div:first-child{min-width:0}
.usual-row .chip-button{display:block;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-align:left}
.dialog{max-height:calc(var(--visible-height) - 32px - env(safe-area-inset-top) - env(safe-area-inset-bottom))}
.modal{padding:max(16px,env(safe-area-inset-top)) max(16px,env(safe-area-inset-right)) max(16px,env(safe-area-inset-bottom)) max(16px,env(safe-area-inset-left))}
@media(hover:hover){.room-object:hover .room-tag{opacity:1;pointer-events:auto}}
@media(hover:none){.room-object:not(.show-tag):not(:focus-visible) .room-tag{opacity:0;pointer-events:none}}
@media(pointer:coarse){
 button,summary,[role=button]{min-width:44px!important;min-height:44px!important}
 a:not(.skip-link):not(.sr-only){display:inline-flex;align-items:center;min-width:44px;min-height:44px;max-width:100%}
 /* A link inside a sentence stays in the sentence, as WCAG 2.5.8 allows. Its padding widens the tap area without moving the words or reaching the line above. */
 :is(p,li,dd,td,figcaption,small)>a:not([class]):not([role]),.app-footer>span:not([class])>a{display:inline;min-width:0;min-height:0;padding:6px;margin:0 -6px}
 /* A ? or a worded link button at the end of a sentence keeps its 44px tap area without making its line taller than the others. */
 :is(p,li,dd,td,small)>.help,:is(p,li,dd,td,small)>button.linklike{margin-block:-12px}
 input:not([type=checkbox]):not([type=radio]):not([type=range]),select,textarea{font-size:max(16px,1em);min-height:44px}
 label:has(input[type=checkbox]),label:has(input[type=radio]),label:has(input[type=file]){min-height:44px;min-width:44px;display:inline-flex;align-items:center;gap:6px}
 .help{width:44px;height:44px;line-height:44px;background:transparent!important;position:relative;isolation:isolate}.help::before{content:"";position:absolute;left:12px;top:12px;width:19px;height:19px;background:var(--chip-bg);border:1px solid var(--line);border-radius:50%;z-index:-1}.help::after{inset:0}
 .notice-compact button{min-height:44px}.room-label-choice{min-height:44px}
}
/* Phone: laptop materials and order, a single icon header and five tabs plus a reserved add action. */
@media(width < 600px){
 body{padding-bottom:0}.shell,.in-room .shell{padding:8px 16px calc(var(--tab-height) + 24px)}
 .shell>.top,.in-room .top{flex-direction:row!important;align-items:center;gap:8px;margin-bottom:8px;min-height:44px}
 /* The brand is a fixed-size wordmark; Larger text still enlarges page content without colliding with icons. */
 .top .brand{font-size:clamp(16px,4.4vw,19.2px)!important}.top .header-tools{align-items:flex-end!important;gap:0;flex:none}
 .header-buttons{flex-wrap:nowrap!important;gap:4px}.header-buttons .theme-toggle{display:inline-flex;align-items:center;justify-content:center;padding:0;width:44px;height:44px;min-width:44px;min-height:44px;font-size:0}
 .header-buttons svg{width:18px;height:18px}.header-buttons .install-icon{display:block}.header-buttons .install-label,.header-buttons .streak-pill>span{display:none}
 .nav{left:env(safe-area-inset-left);right:env(safe-area-inset-right);background:var(--paper);padding:6px 4px calc(6px + env(safe-area-inset-bottom))!important}
 /* The Add slot stays reserved on pages without Add (Goals, Settings), so the five tabs never shift sideways. */
 .nav:has(#fab),.booting .nav{grid-template-columns:repeat(5,minmax(0,1fr)) 52px}
 /* Before the Add button has moved into its slot, the bar is already as tall as it will be. */
 .booting .nav{grid-auto-rows:minmax(48px,auto)}
 .nav .fab{position:static;display:grid;width:48px;height:48px;min-width:44px;min-height:44px;margin:auto;padding:0;border:0;border-radius:12px;background:var(--mint)!important;color:var(--on-accent)!important;box-shadow:none!important}
 .nav .fab svg{width:24px;height:24px}.nav button{min-width:44px;min-height:44px}
 /* “Prices updated” spans the page and lines up with the header’s right edge, as it does on larger screens. */
 .price-status{margin:0 0 8px;text-align:right;font-size:.72rem;max-width:none}.notices{margin-bottom:8px}
 /* A trade in History is a stacked row on phones: date and kind, what it was, then the result beside Edit and Delete. As a table it needed sideways scrolling, hid its buttons past the card's edge and squeezed the details to one word a line. */
 .history-table{overflow-x:visible}.history-table table,.history-table tbody{display:block;width:100%}
 .history-table thead{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
 .history-table tbody tr{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:4px 10px;align-items:center;padding:12px 0;border-bottom:1px solid var(--row-line)}
 .history-table tbody tr:last-child{border-bottom:0}
 .history-table tbody td{display:block;width:auto!important;min-width:0;padding:0;border:0;text-align:left}
 .history-table tbody td.hide-mobile{display:none}
 .history-table tbody td:nth-child(1){color:var(--muted);font-size:.8rem}.history-table tbody td:nth-child(2){justify-self:end}
 .history-table tbody td:nth-child(3){grid-column:1/-1;overflow-wrap:anywhere}
 .history-table tbody td.row-actions{display:flex;gap:6px;justify-self:end;grid-column:2}
 /* Page headings stack on phones and start at the left edge like the rest of the page; the laptop row centers them vertically instead. */
 .hero{align-items:flex-start}
 .room-heading{gap:8px;margin-bottom:4px}.room-heading-actions{gap:6px}.room-noodles{padding-inline:6px}.room-label-choice{gap:4px;font-size:.7rem}
 .room-heading p{font-size:.7rem}.room-tools{margin-bottom:4px}.room-answer{flex-direction:column;align-items:flex-start;justify-content:center}
 .room-viewport{width:calc(100% + 32px);margin-left:-16px}
 .hero .toolbar .primary{display:inline-flex}.hide-mobile{display:none}
}
/* Tablet uses the laptop structure, including its top tabs; only header spacing must compress. */
@media(600px <= width < 1024px){
 .shell{padding:24px}.top{flex-direction:row;gap:12px;align-items:center}.top .brand{font-size:clamp(16px,2.6vw,24.8px)!important}
 .header-tools{align-items:flex-end}.header-buttons{flex-wrap:nowrap;gap:6px}.header-buttons .theme-toggle{padding:7px 8px;font-size:12px;white-space:nowrap}
 .grid,.money-grid{grid-template-columns:minmax(0,1.35fr) minmax(0,.85fr)}.cards{grid-template-columns:repeat(auto-fit,minmax(min(180px,100%),1fr))}
}
/* Phone sideways: one laptop-order header row and a height-fitted whole room. */
@media(height < 500px) and (pointer:coarse){
 body{padding-bottom:env(safe-area-inset-bottom)}.shell,.in-room .shell{padding:4px 12px 12px}
 .shell>.top,.in-room .top{display:flex;align-items:center;flex-direction:row!important;gap:8px;min-height:44px;margin-bottom:4px}
 .top .brand{font-size:17.6px!important}.top .sub{display:none}.header-tools{flex:none;gap:0}.header-buttons{flex-wrap:nowrap!important;gap:4px}
 .header-buttons .theme-toggle{display:inline-flex;align-items:center;justify-content:center;padding:0;width:44px;height:44px;font-size:0}
 .header-buttons svg{width:18px;height:18px}.header-buttons .install-icon{display:block}.header-buttons .install-label,.header-buttons .streak-pill>span,.header-buttons .hide-mobile{display:none}
 .top>.nav{position:static;display:flex!important;flex:1;justify-content:center;flex-wrap:nowrap;gap:2px;margin:0!important;padding:0!important;overflow:visible;min-width:0;border:0;background:none}
 .top>.nav button{display:inline-flex;flex-direction:row;justify-content:center;gap:4px;min-height:44px;padding:4px 6px;font-size:.7rem;white-space:nowrap}.top>.nav svg{width:17px;height:17px}
 .notices{margin-bottom:4px}.price-status{margin-bottom:4px}.notice-demo{padding:0 6px!important}.notice-compact{line-height:1.3}
 #roomHost{display:grid;grid-template-columns:minmax(170px,1fr) minmax(0,1.2fr);gap:4px 12px}
 .room-heading{grid-column:1;max-width:none;width:100%;margin:0;gap:8px}.room-heading h1{font-size:1rem}.room-heading p{font-size:.65rem}.room-heading-actions{gap:4px}.room-noodles{padding-inline:5px}
 .room-tools{grid-column:2;max-width:none;width:100%;margin:0}.room-answer{font-size:.75rem;padding:4px 8px}.room-spent{font-size:.7rem;padding:5px}.room-answer>span+span{font-size:.65rem}
 .room-viewport{grid-column:1/-1;width:100%;margin:0;display:block}
 .room-footnote{grid-column:1/-1;margin:0;min-height:44px}.room-shopping{display:block!important}.room-shop{margin:8px auto}
 .room-wake{left:50%;max-width:min(330px,calc(100% - 24px));bottom:4px;padding:8px}
 .room-wake h2{font-size:.9rem}.room-wake p{font-size:.68rem}
}

.touch-check{display:inline-flex;align-items:center;justify-content:center;flex:none}.touch-check input{margin:0}
/* Phone controls carry their meaning in visible text, with Appearance available in Settings. */
@media(width < 600px){.header-buttons #themeToggle{display:none}.header-buttons #streakPill{width:auto;min-width:52px;padding:0 6px;gap:3px;font-size:.75rem}.header-buttons .streak-pill>span{display:inline}.header-buttons #installApp{width:auto;min-width:58px;padding:0 8px;font-size:.75rem}.header-buttons .install-label{display:inline}.header-buttons .install-icon{display:none}}
@media(height < 500px) and (pointer:coarse){.header-buttons #themeToggle{display:inline-flex}.header-buttons #installApp{width:auto;min-width:58px;font-size:.75rem;padding:0 6px}.header-buttons .install-label{display:inline}.header-buttons .install-icon{display:none}.header-buttons #streakPill{width:auto;min-width:52px;gap:3px;font-size:.75rem}.header-buttons .streak-pill>span{display:inline}}
/* Messages take up their own space instead of floating over controls. */
.modal .toasts{position:static!important;inset:auto!important;transform:none!important;width:100%;max-width:none;margin:8px 0;pointer-events:none}.toasts:empty{display:none}.modal .toasts{flex:none}.toasts .toast{pointer-events:none}.toast-action{pointer-events:auto}.modal .toast{width:100%;margin:0}.onboarding-card{margin-bottom:16px}.onboarding-card h2{margin-top:0}.onboarding-card .chips{margin:12px 0}.onboarding-actions{display:flex;flex-wrap:wrap;gap:8px}.onboarding-school-offer{margin:8px 0 16px}.school-next-title{font-family:'DM Serif Display',Georgia,serif;font-size:1.5rem;line-height:1.25}.school-next-title strong{font-weight:400}
/* The welcome card is part of the room, never a blocking dialog. */
.room-welcome{max-width:min(350px,calc(100% - 24px));max-height:calc(100% - 12px);overflow-y:auto;left:50%;bottom:6px;padding:10px}.room-welcome h2{font-size:1rem}.room-welcome .welcome-looks{display:flex;gap:5px}.welcome-looks button{flex:1;min-width:0;min-height:60px;font-size:.78rem;line-height:1.2;padding:6px;border:1px solid var(--line);background:var(--card);color:var(--ink);border-radius:8px}.welcome-looks i{display:block;width:100%;height:10px;margin-bottom:5px;background:var(--look)}.room-welcome .welcome-links{display:flex;flex-wrap:wrap;gap:4px 12px}.room-welcome .linklike{font-size:.8rem}.room-welcome>div{margin-top:6px}.room-welcome .welcome-links button{flex:none}.room-welcome .welcome-restore{width:100%;text-align:left;font-size:.78rem}.room-group-modal{background:transparent!important;backdrop-filter:none!important}.room-group-dialog{position:fixed;margin:0;width:min(310px,calc(100vw - 24px));max-height:calc(var(--visible-height) - 24px);padding:12px;box-shadow:0 8px 28px rgba(20,34,28,.24)}.room-group-dialog .dialog-head{margin-bottom:6px}.room-group-dialog h2{font-size:1.1rem}.room-group-dialog #roomGroupChoices{display:grid;gap:4px}.room-group-dialog #roomGroupChoices button{width:100%;text-align:left;min-height:44px;font-size:.82rem}.room-object[hidden]{display:none!important}

.modal{z-index:100}.modal-open .room-welcome{visibility:hidden}

.room-object[data-room-group] .room-tag{top:auto;bottom:3px;max-width:100%}

/* Tags remain inside their own hit area, including the grouped compact scene. */
.room-object .room-tag{top:auto;bottom:2px;max-width:min(64px,calc(100% - 2px));white-space:normal}
/* Phones: a notice reads as one short paragraph with its actions inline, so the safe-to-spend number stays on the first screen.
   Each action keeps a 44px tap area; the negative margin stops that padding from making the notice taller. */
@media(width < 600px){.notice:not(.notice-demo){display:block;padding:8px 12px;font-size:.82rem;line-height:1.4}.notice:not(.notice-demo) p{display:inline;min-width:0}.notice:not(.notice-demo) .notice-actions{display:inline;margin-left:4px}.notice:not(.notice-demo) .notice-actions .secondary{display:inline-block;box-sizing:border-box;min-height:44px;padding:13px 6px;margin:-13px 0;border:0;background:none;box-shadow:none;font-size:.82rem;font-weight:650;text-decoration:underline;color:inherit;vertical-align:baseline}}
/* If another line crosses an integer scene scale, keep the forecast beside Until payday. */
@media(width < 600px){.room-answer.compact-runway .room-answer-dates{flex-wrap:nowrap;gap:4px;white-space:nowrap}.room-answer.compact-runway .room-runway{flex-basis:auto}.room-answer.compact-runway .room-runway::before{content:'· ';color:var(--muted)}.room-answer.compact-runway .room-payday-date{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}.room-answer.compact-runway .room-answer-dates [aria-hidden]{display:none}}
@media(width < 600px){.room-answer.compact-runway .room-period-full{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}.room-answer.compact-runway .room-answer-dates .room-period-compact{display:inline}}
