/* Shared phone controls; desktop designs and selected typography remain intact. */
.web-app-tabs,.web-app-back{display:none}
.web-app-connection[hidden],.web-app-install[hidden]{display:none!important}
.web-app-connection{position:fixed;z-index:80;top:max(.5rem,env(safe-area-inset-top));left:50%;transform:translateX(-50%);width:calc(100% - 2rem);max-width:42rem;display:flex;flex-wrap:wrap;align-items:center;gap:.5rem;padding:.75rem 1rem;border:1px solid #b45309;border-radius:.75rem;background:#fffbeb;color:#78350f;box-shadow:0 4px 18px #17203320;font-size:14px}
.web-app-connection span{flex:1 1 16rem}
.web-app-connection button,.web-app-dialog button,.web-app-dialog a,.web-app-install{min-height:44px;padding:.6rem .85rem;border:1px solid currentColor;border-radius:.5rem;font:inherit;cursor:pointer}
.web-app-dialog{width:calc(100% - 2rem);max-width:30rem;max-height:calc(100dvh - 2rem);overflow:auto;margin:auto;padding:1.5rem;border:1px solid #cbd5e1;border-radius:1rem;background:#fff;color:#172033;line-height:1.6}
.web-app-dialog::backdrop{background:#0f172ad9;backdrop-filter:blur(8px)}
.web-app-dialog h2{margin:0 0 1rem;font-size:1.5rem;font-weight:700;line-height:1.2}
.web-app-dialog p,.web-app-dialog ol{margin:0 0 1rem}.web-app-dialog ol{list-style:decimal;padding-left:1.25rem}
.web-app-dialog a{display:inline-flex;margin-right:.5rem;background:var(--brand-color-600,#4338ca);color:#fff;text-decoration:none}
.web-app-dialog button{margin-top:.5rem}
.web-app-install{margin:.5rem;color:var(--brand-color-700,#4338ca);font-size:13px}
.web-app-tabs :focus-visible,.web-app-back:focus-visible,.web-app-dialog :focus-visible,.web-app-install:focus-visible{outline:3px solid var(--brand-color-600,#6366f1);outline-offset:2px}
@media(max-width:767px){
  :root{--phone-tabs-height:calc(4rem + env(safe-area-inset-bottom));--phone-top-height:calc(3.5rem + env(safe-area-inset-top))}
  .has-mobile-navigation .app-shell-main{padding-top:var(--phone-top-height)!important;padding-bottom:calc(var(--phone-tabs-height) + var(--web-app-status-height,0px) + 1rem)!important;scroll-padding-top:var(--phone-top-height);scroll-padding-bottom:calc(var(--phone-tabs-height) + var(--web-app-status-height,0px) + 1rem);padding-left:max(1rem,env(safe-area-inset-left))!important;padding-right:max(1rem,env(safe-area-inset-right))!important}
  .web-app-tabs{position:fixed;z-index:38;inset:auto 0 0;display:grid;grid-template-columns:repeat(4,minmax(0,1fr));min-height:var(--phone-tabs-height);padding:0 max(.25rem,env(safe-area-inset-right)) env(safe-area-inset-bottom) max(.25rem,env(safe-area-inset-left));border-top:1px solid #cbd5e1;background:#fff;color:#475569}
  .web-app-tabs a,.web-app-tabs button{display:flex;flex-direction:column;justify-content:center;align-items:center;gap:.25rem;min-height:4rem;min-width:0;padding:.5rem .2rem;border:0;background:transparent;color:inherit;text-decoration:none;font-size:11px;line-height:1.2;touch-action:manipulation}
  .web-app-tabs i{font-size:18px}.web-app-tabs [aria-current=page],.web-app-tabs [aria-expanded=true]{color:var(--brand-color-700,#4338ca);background:color-mix(in srgb,var(--brand-color-600,#4f46e5) 8%,white)}
  .web-app-back{position:fixed;z-index:38;top:max(.4rem,env(safe-area-inset-top));right:max(1rem,env(safe-area-inset-right));display:block;min-height:44px;padding:.5rem 1rem;border:1px solid #cbd5e1;border-radius:.6rem;background:#fff;color:#334155}
  .has-mobile-navigation .site-menu-toggle{top:max(.4rem,env(safe-area-inset-top));left:max(1rem,env(safe-area-inset-left));min-width:44px;min-height:44px}
  .has-mobile-navigation .site-menu{padding-top:max(.9rem,env(safe-area-inset-top))!important;padding-bottom:max(.75rem,env(safe-area-inset-bottom))!important}
  .web-app-keyboard-open .web-app-tabs{display:none}
  .web-app-keyboard-open .app-shell-main{padding-bottom:1rem!important}
  body input:not([type=checkbox]):not([type=radio]):not([type=hidden]),body select,body textarea{font-size:16px!important;min-height:44px}
  body button,body [role=button]{touch-action:manipulation}
  .web-app-connection{top:auto;bottom:calc(var(--phone-tabs-height,0px) + .5rem);font-size:13px}
  .has-mobile-navigation .page-help-button{bottom:calc(var(--phone-tabs-height) + var(--web-app-status-height,0px) + .75rem)!important}
  .transaction-editor__actions{position:sticky;bottom:0;padding:.75rem;background:var(--transaction-card-bg,#fff);border-top:1px solid #e2e8f0;z-index:2}
  .web-app-dialog{padding:1.25rem;max-height:calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 2rem)}
  .login-stage{padding-top:max(1rem,env(safe-area-inset-top));padding-bottom:max(1rem,env(safe-area-inset-bottom))}
}
@media(display-mode:standalone){.web-app-install{display:none!important}}
@media print{.web-app-tabs,.web-app-back,.web-app-connection,.web-app-install{display:none!important}}
@media(max-width:767px){
  .has-mobile-navigation::before{content:"";position:fixed;inset:0 0 auto;height:var(--phone-top-height);z-index:37;background:#f8fafc;border-bottom:1px solid #e2e8f0}
  .theme-professional.has-mobile-navigation::before,.theme-professional .web-app-tabs{background:#fafaf8}
}

@media(max-width:767px){.web-app-keyboard-open .web-app-connection{bottom:.5rem}}
.transaction-phone-edit-button{display:none}
@media(max-width:767px){
  .transaction-phone-edit-button{display:flex;margin:1rem 0 0;width:100%;justify-content:center;min-height:48px}
  .transaction-detail-grid>.transaction-editor{display:none}
  .transaction-phone-editor{width:100%;max-width:none;height:100dvh;max-height:100dvh;margin:0;border:0;border-radius:0;padding:max(1rem,env(safe-area-inset-top)) max(1rem,env(safe-area-inset-right)) max(1rem,env(safe-area-inset-bottom)) max(1rem,env(safe-area-inset-left));background:#f8fafc}
  .transaction-phone-editor>.transaction-editor{margin-top:1rem}
  .transaction-phone-editor .transaction-editor__actions{bottom:calc(-1 * max(1rem,env(safe-area-inset-bottom)));padding-bottom:max(1rem,env(safe-area-inset-bottom))}
}
/* A boolean hidden state must win over a component's flex/grid display rule. */
[hidden]:not([hidden="until-found"]){display:none!important}
.web-app-connection[data-tone=info]{background:#eff6ff;color:#1e3a8a;border-color:#93c5fd}
.web-app-session>a{margin-top:1rem;display:block;background:transparent;color:#475569;font-size:13px}
.web-app-reauth{width:calc(100% - 1rem);max-width:48rem;height:calc(100dvh - 1rem);max-height:calc(100dvh - 1rem)}
.web-app-reauth iframe{display:block;width:100%;min-height:32rem;height:calc(100% - 16rem);margin-top:1rem;border:1px solid #cbd5e1;border-radius:.5rem;background:#fff}
.login-embedded .login-story,.login-embedded .web-app-install{display:none!important}
.login-embedded .login-stage{min-height:100dvh;padding:1rem;display:block}
.login-embedded .login-main{width:100%;max-width:32rem;margin:auto}
.login-embedded .login-shell{display:block}
@media(max-width:767px){.web-app-reauth{margin:0;width:100%;height:100dvh;max-height:100dvh;border-radius:0}.web-app-reauth iframe{min-height:36rem}}

@media(max-width:767px) {
  /* The phone navigation owns the menu button; page titles align to the gutter. */
  body.has-mobile-navigation .ops-main .page-header { padding-left:.75rem!important; padding-right:.75rem!important; }
}
