/* App shell: top navigation, month pill, person menu, admin frame, phone tab bar, sign-in, banners, modal, generic states.
   The .m-* components themselves are in frs.css; the screens built before the new design keep base.css and their own sheets. */

/* ------------------------------------------------------------- top navigation */
.app { min-height: 100vh; }
.m-top .m-logo-link { display: flex; align-items: center; flex: none; border-radius: 6px; }
.m-top .m-area { padding-left: 16px; border-left: 1px solid var(--line); font-size: 15px; line-height: 22px; font-weight: 600; }
.m-menu a { text-decoration: none; }
.m-menu em { color: var(--ink); }
.m-top-right { position: relative; }
.m-period { position: relative; color: var(--ink); }
.m-period select { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; font: inherit; border: 0; }
.m-period:focus-within, .m-me:focus-visible, .m-ask:focus-visible { outline: var(--focus-ring); outline-offset: 2px; }
.m-period .m-ic { color: var(--ink-3); }
.m-ask { text-decoration: none; }
.m-ask kbd { color: var(--ink-3); }
.m-me { color: var(--ink); }
.m-me .m-ic { width: 14px; height: 14px; color: var(--ink-3); }
.m-pop { position: absolute; z-index: 60; top: 48px; right: 0; width: 230px; padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh-3); animation: m-pop .2s var(--ease) both; }
.m-pop .hd { padding: 10px 10px 8px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.m-pop .hd b { display: block; font-weight: 600; }
.m-pop .hd span { font-size: 12.5px; color: var(--ink-3); }
.m-pop button, .m-pop a { display: flex; gap: 10px; align-items: center; width: 100%; height: 38px; padding: 0 10px; border: 0; border-radius: var(--r-sm); background: transparent; color: var(--ink); text-align: left; font-weight: 500; font-size: 14px; cursor: pointer; text-decoration: none; }
.m-pop button:hover, .m-pop a:hover { background: var(--hover); text-decoration: none; }
.m-pop .m-ic { color: var(--ink-3); }
.m-av { text-transform: uppercase; }

/* ------------------------------------------------------------- page frame */
.page { min-width: 0; }
.page > .m-page, .page > .page-in { padding-top: 28px; }
/* A page section keeps no transform after it has risen in, and the page is not a size container: either one would make it the
   containing block of every fixed-position sheet, dialog and drawer inside it (a zero-height box when its content is a layer). */
.m-page > * { animation-fill-mode: backwards; }
.m-page > .plan-layer { animation: none; }
.m-page.page-in { max-width: 1320px; }
.m-blocked { display: flex; align-items: center; gap: 12px; padding: 18px 20px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--sh-1); color: var(--ink-2); }
.m-blocked .m-ic { color: var(--ink-3); flex: none; }
.m-admin-wrap { max-width: 1320px; margin: 0 auto; padding: 28px 32px 64px; }
.m-admin-wrap .m-admin { align-items: start; }
.m-admin-wrap .m-subnav { top: 88px; }
.m-subnav a { text-decoration: none; }
.m-subnav .m-ic { color: var(--ink-3); flex: none; }
.m-subnav hr { border: 0; border-top: 1px solid var(--line); margin: 8px 0; width: 100%; }

/* ------------------------------------------------------------- sign-in */
.login { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 24px; background: var(--canvas); overflow-y: auto; }
.login .box { width: min(100%, 380px); display: grid; gap: 16px; padding: 32px 32px 28px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); box-shadow: var(--sh-2); animation: m-rise .4s var(--ease) both; }
.login .box .m-logo { height: 24px; margin-bottom: 6px; }
.login .box h1 { font-size: 26px; line-height: 32px; font-weight: 600; letter-spacing: -0.025em; }
.login .box .m-input { width: 100%; height: 42px; font-size: 15px; }
.login .box .m-btn { width: 100%; height: 44px; font-size: 15px; }
.login .box .lnk { justify-self: center; padding: 6px 4px; border: 0; background: none; color: var(--brand-deep); font: inherit; font-size: 13.5px; font-weight: 500; cursor: pointer; }
.login .box .lnk:hover { text-decoration: underline; text-underline-offset: 3px; }
.login .box .m-note { font-size: 13.5px; color: var(--ink-2); }

/* ------------------------------------------------------------- phone tab bar (read only) */
.m-tabbar { display: none; }
.m-tabbar a { text-decoration: none; }
.m-tabbar .cnt { position: absolute; top: 2px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--coral); color: var(--ink); font-size: 11px; font-weight: 600; display: grid; place-items: center; }
.m-tabbar a { position: relative; }

/* ---- banners with actions */
.bns { display: grid; gap: 10px; margin: 0 0 18px; }
.callout.bn { align-items: center; }
.callout.bn .bt { flex: 1; min-width: 0; display: grid; gap: 1px; }
.callout.bn .bt span { font-weight: 500; }
.callout.bn .bn-act { display: flex; gap: 8px; flex-wrap: wrap; flex: none; }
.callout.bn .btn { background: var(--paper); color: var(--ink); }
.callout.bn .btn.pri { background: var(--brand); color: var(--on-brand); }
.callout.bn .btn.quiet { background: transparent; }
@media (max-width: 760px) { .callout.bn { flex-wrap: wrap; } .callout.bn .bn-act { width: 100%; } }

/* ---- modal */
.modal { position: fixed; z-index: 70; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(480px, calc(100vw - 32px)); background: var(--paper); border-radius: var(--r-xl); box-shadow: var(--sh-3); padding: 22px; animation: m-pop .2s var(--ease) both; display: grid; gap: 12px; }
.modal h2 { margin: 0; font-size: 19px; font-weight: 600; letter-spacing: -.02em; }
.modal p { margin: 0; color: var(--ink-2); }
.modal .mf { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
#reopen-scrim { z-index: 69; }
.ferr { color: var(--red); font-size: 13px; font-weight: 500; min-height: 0; }
.ferr:empty { display: none; }
.in[aria-invalid="true"] { border-color: var(--red); }

/* ---- generic states */
.stt { display: grid; justify-items: center; gap: 4px; text-align: center; padding: 24px 18px; border: 1px dashed var(--line-2); border-radius: var(--r); color: var(--ink-3); }
.stt .ic { width: 26px; height: 26px; color: var(--ink-4); margin-bottom: 4px; }
.stt b { color: var(--ink); font-size: 15px; font-weight: 600; } .stt p { margin: 0 0 8px; max-width: 42ch; }
.stt.err { border-style: solid; border-color: var(--bad-bd); background: var(--red-t); } .stt.err .ic { color: var(--red); } .stt.err p { color: var(--bad-ink); }
.skel { display: grid; gap: 10px; padding: 6px 2px; }
.skl { display: block; height: 12px; border-radius: 6px; background: linear-gradient(90deg, var(--sunk) 25%, var(--line) 50%, var(--sunk) 75%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
.skl.w40 { width: 40%; height: 16px; } .skl.w90 { width: 90%; } .skl.w75 { width: 75%; } .skl.w85 { width: 85%; } .skl.w60 { width: 60%; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---- small shared pieces */
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.boot { min-height: 100vh; background: var(--canvas); }
.toast a { margin-left: 6px; color: #fff; text-decoration: underline; text-underline-offset: 3px; }
.toast .ic { width: 16px; height: 16px; color: var(--toast-ok); }
.toast { font-weight: 500; font-size: 14px; max-width: 92vw; }

/* ---- legacy frame (kept for #/legacy/<view> until the Monthly close screen replaces the upload view) */
.page[hidden], .legacy-host[hidden], .legacy-frame[hidden] { display: none; }
.legacy-host { height: calc(100vh - var(--top-h)); display: flex; flex-direction: column; }
.legacy-frame { flex: 1; width: 100%; min-height: 0; border: 0; background: var(--canvas); display: block; }

/* ------------------------------------------------------------- responsive */
@media (max-width: 1100px) { .m-menu a { padding: 0 9px; } .m-top { gap: 18px; padding: 0 16px; } }
@media (max-width: 1280px) { .m-ask kbd { display: none; } .m-me > span:last-child span { display: none; } }
@media (max-width: 960px) { .m-me > span:last-child { display: none; } .m-top { gap: 12px; } }
@media (max-width: 760px) {
  .m-top { height: 56px; padding: 0 16px; gap: 12px; }
  .m-ask, .m-top .m-area { display: none; }
  .m-period { padding: 0 10px; }
  .m-me > span:last-child { display: none; }
  .page > .m-page, .page > .page-in { padding: 16px 16px 96px; gap: 14px; }
  .m-admin-wrap { padding: 16px 16px 40px; }
  .m-tabbar { display: grid; grid-template-columns: repeat(var(--tabs, 4), 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; }
  .m-tabbar { background: rgba(255, 255, 255, .95); border-top: 1px solid var(--line); padding: 6px 4px calc(10px + env(safe-area-inset-bottom)); }
  .toast { bottom: 84px; }
  .legacy-host { height: calc(100dvh - 56px - 66px); }
  .login { padding: 16px; place-items: start center; }
  .login .box { padding: 24px 20px; margin-top: 8vh; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { animation: none !important; transition: none !important; } }
