/* Shared interaction states; desktop layout remains in app.css. */
.mobile-context,.mobile-header-action,.bottom-nav,.sheet-handle,.mobile-filter-trigger,.mobile-filter-actions{display:none}
.is-loading:not(tr){position:relative;pointer-events:none;display:inline-flex;align-items:center;justify-content:center;gap:8px;overflow:hidden;white-space:nowrap;box-sizing:border-box}
tr.is-loading{opacity:.65}
.processing-label{overflow:hidden;text-overflow:ellipsis;min-width:0}
.button-spinner{display:inline-block;flex:0 0 14px;width:14px;height:14px;border:2px solid currentColor;border-right-color:transparent;border-radius:50%;animation:button-spin .7s linear infinite}
@keyframes button-spin{to{transform:rotate(360deg)}}
.processing-status{position:fixed;left:50%;bottom:24px;transform:translateX(-50%);z-index:120;background:#3f382f;color:#fff;padding:10px 16px;border-radius:12px;max-width:calc(100% - 32px);font-size:14px;box-shadow:0 4px 18px #0002;pointer-events:none}
.processing-status:empty{display:none}
.processing-status.processing-status-local{width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
.is-processing::before{content:"";position:fixed;inset:0 0 auto;height:3px;background:#a38b62;z-index:150;animation:processing-line 1.2s ease-in-out infinite;transform-origin:left}
@keyframes processing-line{0%{transform:scaleX(.1)}60%{transform:scaleX(.75)}100%{transform:scaleX(1);opacity:.3}}
.sheet-open{overflow:hidden;overscroll-behavior:none}
.sheet-content{padding:28px}
.sheet-content h2{margin-top:0}
.sheet-content p{line-height:1.5}
.quick-actions{display:flex;flex-direction:column;gap:8px}
.quick-actions a,.quick-actions>button:not(.sheet-handle){text-align:left;padding:14px;background:transparent;border:0;color:inherit;font:inherit;text-decoration:none}
.install-app-button{font:inherit;text-align:left}
.gallery-button{position:relative;overflow:hidden}
.gallery-button input[type=file]{display:block;position:absolute;inset:0;width:100%;height:100%;opacity:0;cursor:pointer}
.gallery-button:focus-within{outline:3px solid #a38b62;outline-offset:3px}
.scanner-ready{font-size:13px;text-align:center;margin:0;color:inherit}

@media(max-width:760px){
  :root{--mobile-nav-height:64px;--mobile-bottom:calc(var(--mobile-nav-height) + env(safe-area-inset-bottom,0px));--mobile-header-height:calc(60px + env(safe-area-inset-top,0px))}
  html{scroll-padding-top:calc(var(--mobile-header-height) + 16px);scroll-padding-bottom:calc(var(--mobile-bottom) + 90px)}
  body{min-height:100svh;overflow-wrap:anywhere}
  .app-header{height:var(--mobile-header-height);min-height:var(--mobile-header-height);padding:env(safe-area-inset-top,0px) max(12px,env(safe-area-inset-right,0px)) 0 max(12px,env(safe-area-inset-left,0px));grid-template-columns:minmax(0,1fr) auto auto;gap:8px;z-index:40}
  .has-mobile-context .app-header>.brand{display:none}
  .mobile-context{display:flex;align-items:center;min-width:0;gap:4px}
  .mobile-header-title{font-size:17px;font-weight:650;line-height:1.15;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
  .mobile-header-back{display:flex;align-items:center;justify-content:center;flex:0 0 44px;width:44px;height:44px;font-size:32px;text-decoration:none;color:inherit;margin-left:-8px}
  .mobile-header-action{display:flex;align-items:center;min-width:0}
  .mobile-header-action .button{min-height:44px;padding:9px 10px;font-size:13px;max-width:144px;white-space:nowrap}
  .reports-list-page .page-heading>a.button-primary,.report-detail-page .mobile-add{display:none}
  .account-menu summary{min-width:44px;min-height:44px;display:flex;align-items:center;justify-content:center}
  .account-popover{max-width:calc(100vw - 24px);max-height:calc(100dvh - var(--mobile-header-height) - var(--mobile-bottom));overflow:auto}
  .account-popover a,.account-popover button{width:100%;min-height:44px;display:flex;align-items:center}
  .account-popover form .text-button{min-height:44px}
  .account-popover [hidden]{display:none}
  .has-mobile-context main .back-link:not(.auth-secondary-link),.has-mobile-context main .breadcrumb{display:none}
  .has-mobile-context .mobile-context-title{position:absolute!important;width:1px!important;height:1px!important;margin:-1px!important;padding:0!important;overflow:hidden!important;clip-path:inset(50%);white-space:nowrap}
  .has-mobile-context .page-heading{margin-bottom:16px;min-height:0}
  .has-mobile-context .page-heading:has(>div:only-child){margin:0}
  .bottom-nav{position:fixed;inset:auto 0 0;z-index:45;display:flex;align-items:stretch;justify-content:space-around;min-height:var(--mobile-bottom);padding:4px max(6px,env(safe-area-inset-right,0px)) env(safe-area-inset-bottom,0px) max(6px,env(safe-area-inset-left,0px));background:#fffdf9;border-top:1px solid #e5dfd5;box-sizing:border-box}
  .bottom-nav a,.bottom-nav-action{display:flex;flex:1;flex-direction:column;align-items:center;justify-content:center;gap:3px;min-width:0;min-height:56px;max-width:140px;padding:0 2px;color:#776f64;text-decoration:none;font:600 11px/1.1 inherit;white-space:nowrap;border:0;border-radius:12px;background:transparent;cursor:pointer}
  .bottom-nav svg{width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round}
  .bottom-nav a[aria-current=page]{color:#3f382f;background:#eee8df}
  .bottom-nav a.is-loading{flex-direction:column;gap:3px}
  .page-shell,.reports-list-page .page-shell,.report-detail-page .page-shell,.review-page .page-shell{padding-left:max(16px,env(safe-area-inset-left,0px));padding-right:max(16px,env(safe-area-inset-right,0px));padding-bottom:calc(var(--mobile-bottom) + 100px)}
  input:not([type=checkbox]):not([type=radio]):not([type=hidden]),select,textarea{font-size:16px!important;min-height:44px;max-width:100%;scroll-margin-block:90px}
  input[type=checkbox],input[type=radio]{min-width:20px;min-height:20px}
  label:has(input[type=checkbox]),label:has(input[type=radio]){min-height:44px}
  button,.button,summary,.text-button{min-height:44px;touch-action:manipulation}
  label{line-height:1.45}
  form,.form-stack,.review-form,.form-grid,.page-heading>div{min-width:0}
  .form-actions{position:sticky;bottom:calc(var(--mobile-bottom) + 8px);z-index:10;background:#f8f6f2;padding:12px 0;margin-bottom:0}
  .form-actions .button{min-width:0}
  .report-footer-actions{bottom:calc(var(--mobile-bottom) + 12px);left:16px;right:16px;z-index:30}
  .report-footer-actions form:first-child{display:block}
  .report-footer-actions form[data-confirm]{display:none}
  .report-footer-actions>.button,.report-footer-actions>form:not([data-confirm]){width:100%}
  .report-footer-actions:not(:has(.button-close)):not(:has(>button)){display:none}
  .mobile-priority-actions{margin:0 0 18px;border:1px solid #e4cfae;border-radius:14px;background:#fffaf3;overflow:hidden}
  .mobile-priority-actions h2{margin:0;padding:16px 16px 0;color:#6f512c;font-size:17px}
  .mobile-priority-actions>div{display:grid;gap:8px;padding:16px}
  .mobile-priority-actions>div+div{border-top:1px solid #eadcc5}
  .mobile-priority-actions strong{color:#6f512c;font-size:15px}
  .mobile-priority-actions span{color:#776a59;font-size:13px}
  .mobile-priority-actions form,.mobile-priority-actions .button{width:100%;margin:0}
  .mobile-enhanced .mobile-filter-trigger{display:flex;align-items:center;justify-content:space-between;width:100%;margin-bottom:18px}
  .mobile-enhanced .mobile-filter-actions{display:flex}
  .app-dialog{position:fixed;inset:auto 0 0;margin:0 auto;width:min(100%,600px);max-width:100%;max-height:calc(var(--visual-height,100dvh) - env(safe-area-inset-top,0px) - 12px);border-radius:22px 22px 0 0;padding:0 0 env(safe-area-inset-bottom,0px);overflow:auto;overscroll-behavior:contain;animation:sheet-enter .16s ease-out;box-sizing:border-box}
  .app-dialog::backdrop{background:#211d1880}
  .app-dialog form,.app-dialog .sheet-content{padding:12px 22px 24px;max-height:none;overflow:visible}
  .app-dialog .sheet-content form{padding:0}
  .app-dialog .form-actions{position:static;bottom:auto;background:transparent;padding-bottom:0;flex-wrap:wrap}
  .app-dialog .form-actions>.button{flex:1}
  .sheet-handle{display:block;border:0;background:transparent;width:100%;height:26px;min-height:26px;padding:10px;touch-action:none;cursor:grab}
  .sheet-handle::after{content:"";display:block;width:36px;height:4px;border-radius:4px;background:#c9c0b4;margin:auto}
  .dialog-close{min-width:44px;min-height:44px;top:24px}
  .app-dialog h2{font-size:23px;padding-right:25px}
  .app-dialog .filters{display:grid;grid-template-columns:1fr;gap:16px;overflow:visible;margin:0}
  .app-dialog .filters label{min-width:0;width:100%}
  .app-dialog .filters select{width:100%}
  @keyframes sheet-enter{from{transform:translateY(30px);opacity:.4}to{transform:translateY(0);opacity:1}}
  .modal-actions{bottom:calc(var(--mobile-bottom) + 8px)}
  .processing-status{bottom:calc(var(--mobile-bottom) + 14px);font-size:13px}
  .keyboard-open .bottom-nav,.keyboard-open .report-footer-actions{display:none}
  .keyboard-open .form-actions,.keyboard-open .modal-actions{position:static}
  .keyboard-open .processing-status{bottom:12px}
  .login-page{min-height:100svh;padding:max(24px,env(safe-area-inset-top,0px)) max(20px,env(safe-area-inset-right,0px)) max(24px,env(safe-area-inset-bottom,0px)) max(20px,env(safe-area-inset-left,0px))}
  .login-panel{max-width:100%;min-width:0}
  .login-page .processing-status{bottom:24px}
  .messages{top:calc(var(--mobile-header-height) + 8px);max-width:calc(100% - 24px);z-index:80}
  .gmail-modal{height:calc(var(--visual-height,100dvh) - var(--mobile-header-height) - var(--mobile-bottom) - 24px);max-height:calc(var(--visual-height,100dvh) - var(--mobile-header-height) - var(--mobile-bottom) - 24px);overflow-x:hidden;overflow-y:auto;overscroll-behavior:contain}
  .gmail-modal .breadcrumb{display:none}
  .gmail-modal .modal-heading{min-width:0}
  .gmail-modal .gmail-search{margin:12px 0;gap:12px}
  .gmail-modal .gmail-discovery-summary{margin-bottom:10px}
  .gmail-selection-form .gmail-list{overflow:visible;padding-bottom:8px}
  .gmail-selection-form .gmail-list-head{position:sticky;top:0;z-index:1;background:#fff}
  .gmail-selection-form .modal-actions{position:sticky;bottom:0;margin-top:10px;padding:10px 0 0;background:#fff}
  .gmail-presets{grid-template-columns:1fr}
  .scanner-page .bottom-nav,.scanner-page .app-header{display:none}
  .scanner-page .page-shell{padding:0;min-height:0;max-width:none}
  .scanner-page{background:#24211d;min-height:100dvh}
  .scanner-shell{height:100dvh;min-height:0;max-width:none;display:flex;flex-direction:column;gap:8px;padding:env(safe-area-inset-top,0px) max(12px,env(safe-area-inset-right,0px)) max(12px,env(safe-area-inset-bottom,0px)) max(12px,env(safe-area-inset-left,0px));box-sizing:border-box;overflow:auto;color:#fff}
  .scanner-heading{flex:0 0 48px;min-height:48px;margin:0;gap:6px}
  .scanner-heading a{min-width:44px;min-height:44px;display:flex;align-items:center;justify-content:center}
  .scanner-heading a,.scanner-shell .gallery-button,.scanner-shell .tone-switch button{color:#3f382f}
  .scanner-heading h1{font-size:18px}
  .scanner-instruction{font-size:13px;line-height:1.35;margin:0 4px;flex:0 0 auto;color:#d5cfc6}
  .camera-stage{flex:1 1 auto;min-height:150px;height:auto;max-height:none;margin:0;border-radius:16px}
  .camera-stage video{width:100%;height:100%;object-fit:cover}
  .capture-controls{flex:0 0 82px;padding:4px 0;margin:0;min-height:82px}
  .shutter{width:72px;height:72px}
  .shutter:disabled{opacity:.4}
  .scanner-adjust{flex:1 1 auto;min-height:0;display:flex;flex-direction:column;gap:8px;margin:0;padding:0}
  .scanner-adjust[hidden],.camera-stage[hidden],.capture-controls[hidden],.scanner-status[hidden],.scanner-error[hidden],.scanner-ready[hidden]{display:none}
  .adjust-preview{flex:1 1 auto;min-height:130px;height:auto;max-height:none}
  .adjust-preview>img{max-height:100%;height:100%;object-fit:contain}
  .tone-switch{margin:0;flex:0 0 auto}
  .tone-switch button{padding:8px}
  .scanner-adjust>.button,.scanner-adjust>.text-button{flex:0 0 auto;margin:0}
  .scanner-adjust>.text-button{color:#fff}
  .scanner-status,.scanner-error{position:static;margin:0;padding:8px 10px;font-size:13px;flex:0 0 auto}
  .scanner-page .processing-status{bottom:max(8px,env(safe-area-inset-bottom,0px))}
}
@media(prefers-reduced-motion:reduce){
  .button-spinner,.is-processing::before,.app-dialog,.processing-spinner{animation:none!important;transition:none!important}
  html{scroll-behavior:auto}
}

@media(max-width:760px){
  .login-page{display:block;min-height:100dvh;overflow-y:auto}
  .login-panel,.auth-panel-wide{width:100%;padding:30px 22px;border-radius:16px}
  .login-brand,.invitation-panel .login-brand{margin-bottom:36px;font-size:27px}
  .login-brand::before{width:40px;height:40px;flex-basis:40px}
  .login-panel h1{font-size:38px}
  .login-panel>p{font-size:16px}
  .auth-product-summary{margin-top:28px}
  .auth-product-summary>div>span{padding:0 4px;font-size:11px}
  .auth-progress{margin-bottom:28px}
  .first-steps{margin-bottom:32px}
  .first-steps summary{min-height:100px;padding:22px 20px}
  .first-steps summary strong{font-size:25px}
  .first-steps-toggle{display:none}
  .first-steps-content{padding:0 20px 20px}
  .first-step{grid-template-columns:30px minmax(0,1fr) auto;gap:11px;min-height:78px}
  .first-step>.button{min-height:42px;padding:0 12px;font-size:12px}
  .first-steps-footer{align-items:flex-start;flex-direction:column;padding:18px}
  .first-steps-footer .button{width:100%}
  .tour-popover{left:12px!important;right:12px!important;top:auto!important;bottom:calc(var(--mobile-bottom,64px) + 12px)!important;width:auto;max-height:calc(100dvh - var(--mobile-bottom,64px) - 24px);overflow:auto;padding:20px}
  .tour-popover.is-finish{inset:auto 12px calc(var(--mobile-bottom,64px) + 12px)!important;transform:none}
  .tour-actions .button{flex:1;min-width:0}
}
