/* Round 5 (2026-11-29): motion system gaps and app-wide polish. Loaded after polish-round4.css. */

/* M12. Reduce Motion: movement becomes a short crossfade, so a window still visibly arrives and leaves. */
@keyframes r5-fade-in{from{opacity:0}to{opacity:1}}
@media (prefers-reduced-motion:reduce){
 dialog[open]{animation:r5-fade-in var(--motion-exit) var(--motion-ease) both}
 #app .screen{animation:r5-fade-in var(--motion-exit) var(--motion-ease) both}
}

/* P1. One figure scale: the hero balance matches Loans (34px), amounts always use tabular figures. */
#app .accounts-summary .metric:first-child strong{font-size:34px;letter-spacing:-.02em;line-height:1.1}
#app :is(.transaction-amount,.metric strong,.account-balance,.wk-amt,.dp-repeat-amount b,.mr-hero strong,.ledger-end){font-variant-numeric:tabular-nums}

/* P2. One spacing grid: 20px card radius everywhere, 16px between stacked cards, 16px card padding on phones. */
#app .settings-grid>.card{border-radius:20px}
#app .settings-grid>.card+.card{margin-top:16px}
#app .account-grid{gap:0}

/* P3. One colour system: the Loans hues (blue, orange, green, red and their darker ink tones) become app tokens. */
:root{--c-blue:#2f6fd6;--c-blue-ink:#2659c0;--c-orange:#f2a23a;--c-orange-ink:#a85a08;--c-green:#1f8a4c;--c-green-ink:#1a7a43;--c-red:#d6452b;--c-red-ink:#b3381f}
html[data-theme=dark]{--c-blue:#7aa7ff;--c-blue-ink:#9cc0ff;--c-orange:#ffb35c;--c-orange-ink:#ffc27a;--c-green:#5fcf8f;--c-green-ink:#6fd39a;--c-red:#ff7a63;--c-red-ink:#ff8a73}
#app .stats-weeks :is(.wk-flex,i.wk-k-flex){background:var(--c-blue)}
#app .stats-weeks :is(.wk-has-bills,i.wk-k-bills){background:var(--c-orange)}
.mr-v2 .mr-pace>i{background:var(--c-blue)}
.mr-v2 :is(.mr-pace>i.is-over,.mr-bar>i){background:var(--c-orange)}
#app .dp-repeats .dp-ring-f,#app .dp-repeats .dp-share>i{stroke:var(--c-blue)}
#app .dp-repeats .dp-share>i{background:var(--c-blue)}
#app .dp-repeats .dp-ring.is-due .dp-ring-f{stroke:var(--c-orange)}

/* P4. Icons: one size per place (20px in rows, 24px in the top bar), one stroke weight. */
#app :is(.transaction .category-icon,.account-symbol,.settings-menu-symbol) svg.icon{width:20px;height:20px}
#app :is(.topbar,.app-header,.mobile-header) svg.icon{width:24px;height:24px}
svg.icon{stroke-width:1.75}

/* P5. Amounts read as figures: a slightly smaller, baseline-aligned rupee sign (see amount-type.js). */
.cur{font-size:.86em;margin-right:.04em;font-weight:inherit;vertical-align:baseline;letter-spacing:0}

/* P6. Dark mode: raised surfaces get lighter instead of heavier shadows; hairlines at 8% white. */
html[data-theme=dark] #app :is(.card,.account-card,.dp-card-box){box-shadow:none}
html[data-theme=dark] #app :is(.card,.dp-card-box){border-color:rgba(255,255,255,.08)}
html[data-theme=dark] dialog :is(.mr-card,.lr-card){border-color:rgba(255,255,255,.08)}
html[data-theme=dark] .pull-ring{box-shadow:none;border:1px solid rgba(255,255,255,.1)}

/* P8, revised (user, 2026-11-29): rings showed on phones and in Search. Fields glow instead; rings only for a laptop keyboard. */
/* Text fields: no ring at all. The field's own edge turns accent with a soft halo, the way iOS fields do, on every device. */
:is(#app,dialog,.search-page) :is(input:not([type=checkbox],[type=radio],[type=range]),textarea,select):focus,:is(#app,dialog,.search-page) :is(input:not([type=checkbox],[type=radio],[type=range]),textarea,select):focus-visible{outline:none!important;border-color:color-mix(in srgb,var(--c-blue) 70%,var(--border))!important;box-shadow:0 0 0 3px color-mix(in srgb,var(--c-blue) 16%,transparent)!important;transition:border-color var(--motion-press) var(--motion-ease),box-shadow var(--motion-press) var(--motion-ease)}
/* Search boxes: the halo sits on the whole box, not on the bare input inside it. */
:is(#app,dialog,.search-page) :is(.search-page-field,label.search,.lx-sbox,.cc-search):focus-within{border-color:color-mix(in srgb,var(--c-blue) 70%,var(--border));box-shadow:0 0 0 3px color-mix(in srgb,var(--c-blue) 16%,transparent)}
:is(#app,dialog,.search-page) :is(.search-page-field,label.search,.lx-sbox,.cc-search) input:focus{box-shadow:none!important;border-color:transparent!important}
/* Buttons and rows: touch screens never show a ring (the press itself is the feedback). A keyboard on a laptop gets one soft ring. */
@media (pointer:coarse){:is(#app,dialog,.search-page) :is(button,a[href],summary,[role=tab],[role=button],[tabindex]):focus-visible{outline:none}}
@media (pointer:fine){:is(#app,dialog,.search-page) :is(button,a[href],summary,[role=tab],[role=button],[tabindex]):focus-visible{outline:2px solid color-mix(in srgb,var(--c-blue) 60%,transparent);outline-offset:2px}}

/* P9. Tab bar: the active tab also gains weight (not colour alone) and the bar blurs what passes beneath it. */
.navigation .nav-item.active{font-weight:650}
@supports ((-webkit-backdrop-filter:blur(1px)) or (backdrop-filter:blur(1px))){
 html[data-theme]:not([data-theme=grey-glass]) .navigation{-webkit-backdrop-filter:saturate(1.6) blur(16px);backdrop-filter:saturate(1.6) blur(16px)}
}

/* P11. Toasts: one place above the tab bar, one line, the action word in the accent colour. */
.toast{max-width:min(440px,calc(100vw - 24px));border-radius:16px}
.toast>span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.toast .toast-action{color:var(--c-blue-ink);font-weight:650}
html[data-theme=dark] .toast .toast-action{color:var(--c-blue-ink)}

/* M9. A deleted row folds away before the list re-renders. */
.r5-removing{overflow:hidden;pointer-events:none}

/* I4. The month swipe on the Transactions list shows which way it is going. */
#app .ledger.r5-month-out{transition:transform var(--motion-enter) var(--motion-ease),opacity var(--motion-enter) var(--motion-ease)}

/* Home month picker: the Stats picker, months only (Home always shows one month). */
.smp-panel[data-kind=home] .smp-seg{display:none}

/* Day-to-day running total, simplified (user, 2026-11-29 "garbled"): one budget line, a soft area under this month,
   the comparison as a quiet grey line, the projection as a light dotted continuation; the diagonal pace line is gone. */
html[data-theme] #app .dtd-plot .dtd-pace{display:none}
html[data-theme] #app .dtd-plot .dtd-grid{stroke:color-mix(in srgb,var(--text) 7%,transparent);stroke-dasharray:none}
html[data-theme] #app .dtd-plot .dtd-budget{stroke:color-mix(in srgb,var(--c-orange) 70%,transparent);stroke-width:1.25;stroke-dasharray:none}
html[data-theme] #app .dtd-plot .dtd-budget-label{fill:var(--c-orange-ink);font-weight:600}
html[data-theme] #app .dtd-plot .dtd-comp{stroke:color-mix(in srgb,var(--text) 32%,transparent);stroke-width:1.5;stroke-dasharray:none;fill:none}
html[data-theme] #app .dtd-plot .dtd-actual{stroke:var(--c-blue);stroke-width:2.5;stroke-linejoin:round;stroke-linecap:round;fill:none}
html[data-theme] #app .dtd-plot .dtd-area{fill:color-mix(in srgb,var(--c-blue) 13%,transparent);stroke:none;pointer-events:none}
html[data-theme] #app .dtd-plot .dtd-forecast{stroke:color-mix(in srgb,var(--c-blue) 55%,transparent);stroke-width:2;stroke-dasharray:1 5;stroke-linecap:round;fill:none}
html[data-theme] #app .dtd-plot .dtd-forecast-end{display:none}
html[data-theme] #app .dtd-plot .dtd-forecast-label{fill:var(--muted);font-weight:500}
html[data-theme] #app .dtd-plot .dtd-today{fill:var(--c-blue);stroke:var(--surface);stroke-width:2.5}

/* ---------- Quality loop, pass 1 fixes (2026-11-30) ---------- */
/* Spending only: the spent figure gets the full row so a six-figure amount never breaks mid-number. */
#app .accounts-summary.is-spending{grid-template-columns:1fr}
#app .accounts-summary.is-spending>.metric{grid-column:1/-1}
#app .accounts-summary .metric strong{white-space:nowrap}
/* Calendar: today's date reads in the darker orange ink on its pale tile (was 2.2:1). */
html[data-theme]:not([data-theme=dark]) #app .calendar-studio .calendar-day.today .calendar-date-number{color:#7a4105}
html[data-theme=dark] html[data-theme]:not([data-theme=dark]) #app .calendar-studio .calendar-day.today .calendar-date-number{color:#7a4105}
/* Month picker in dark: a hairline edge and a lift so the panel separates from the page behind it. */
html[data-theme=dark] .smp-panel{box-shadow:0 0 0 1px rgba(255,255,255,.1),0 18px 40px -12px rgba(0,0,0,.6)}

/* ---------- Micrographics (2026-11-30): printed-matter marks from micrographics.js, usable anywhere ---------- */
:root{--mg-mono:ui-monospace,"SF Mono","JetBrains Mono",Menlo,Consolas,monospace;--mg-ink:var(--text);--mg-off:color-mix(in srgb,var(--text) 12%,transparent)}
/* Pill bars: tall rounded stubs, the repaid share in ink. They rise into place when they first appear. */
.mg-pills{display:grid;grid-auto-flow:column;grid-auto-columns:minmax(0,1fr);gap:3px;height:18px;align-items:stretch}
.mg-pills>i{display:block;border-radius:999px;background:var(--mg-off)}
.mg-pills>i[data-on]{background:var(--mg-ink)}
@media (prefers-reduced-motion:no-preference){.mg-pills>i[data-on]{animation:mg-pill var(--motion-move) var(--motion-ease) both}}
@keyframes mg-pill{from{transform:scaleY(.35);opacity:.2}to{transform:none;opacity:1}}
/* Payment rhythm: a dash for a month paid in full, a dot for part, a hollow ring for a missed month, a faint dot when nothing was due. */
.mg-rhythm{display:grid;grid-auto-flow:column;grid-auto-columns:minmax(0,1fr);gap:3px;align-items:center;height:12px}
.mg-rhythm>i,.mg-rhythm-key i{display:block;justify-self:center;height:6px;border-radius:999px}
.mg-rhythm>i[data-s=paid],.mg-rhythm-key i[data-s=paid]{width:100%;background:var(--mg-ink)}
.mg-rhythm>i[data-s=part],.mg-rhythm-key i[data-s=part]{width:4px;height:4px;background:var(--mg-ink)}
.mg-rhythm>i[data-s=miss],.mg-rhythm-key i[data-s=miss]{width:6px;box-shadow:inset 0 0 0 1.5px var(--c-red)}
.mg-rhythm>i[data-s=none]{width:3px;height:3px;background:var(--mg-off)}
.mg-rhythm-key{display:flex;flex-wrap:wrap;gap:4px 14px;font-size:12px;color:var(--muted)}
.mg-rhythm-key>span{display:inline-flex;align-items:center;gap:6px}
.mg-rhythm-key i[data-s=paid]{width:14px}
/* Tenure ruler: hairline ticks a month apart, January a little taller, done months in ink, this month tallest. */
.mg-ruler{display:flex;justify-content:space-between;align-items:flex-end;height:20px}
.mg-ruler>i{display:block;flex:0 0 2px;border-radius:1px;height:8px;background:var(--mg-off)}
.mg-ruler>i[data-y]{height:14px}
.mg-ruler>i[data-on]{background:var(--mg-ink)}
.mg-ruler>i[data-now]{flex-basis:3px;height:20px;background:var(--mg-ink)}
/* Repeat payments: a small twelve-month rhythm under each name. */
#app .dp-repeats .dp-repeat-text .mg-rhythm{width:min(132px,100%);height:8px;margin-top:6px;gap:2px;--mg-ink:color-mix(in srgb,var(--text) 72%,transparent)}
#app .dp-repeats .dp-repeat-text .mg-rhythm>i{height:4px}
#app .dp-repeats .dp-repeat-text .mg-rhythm>i[data-s=part],#app .dp-repeats .dp-repeat-text .mg-rhythm>i[data-s=miss]{width:4px}
