/* V36.7.20 — dashboard loading feedback, compact navigation, stable landscape drawer/chat, fitted focus. */

/* Refresh feedback is shown on each of the four dashboard KPI cards. */
#seasonal-dashboard .seasonal-kpi { position:relative !important; }
#seasonal-dashboard .seasonal-kpi.is-loading {
  border-color:rgba(151,211,255,.62) !important;
  box-shadow:0 0 0 1px rgba(130,196,255,.12), 0 0 22px rgba(70,160,235,.14) !important;
}
#seasonal-dashboard .seasonal-kpi.is-loading .kpi-icon {
  animation:v3720-kpi-pulse .85s ease-in-out infinite alternate !important;
}
#seasonal-dashboard .seasonal-kpi.is-loading::before {
  content:"" !important;
  position:absolute !important;
  top:12px !important; right:14px !important;
  width:15px !important; height:15px !important;
  border:2px solid rgba(190,220,255,.24) !important;
  border-top-color:var(--scene-accent,#79cfff) !important;
  border-radius:50% !important;
  animation:v3720-spin .72s linear infinite !important;
  pointer-events:none !important;
}
#dashboard-refresh.is-loading { opacity:.9 !important; cursor:wait !important; }
#dashboard-refresh.is-loading::first-letter { display:inline-block; animation:v3720-spin .8s linear infinite; }
@keyframes v3720-spin { to { transform:rotate(360deg); } }
@keyframes v3720-kpi-pulse { from { opacity:.62; } to { opacity:1; filter:brightness(1.28); } }

/* The portrait drawer was consuming too much of the phone width. */
@media (max-width:600px) and (orientation:portrait) {
  #app-sidebar.app-sidebar {
    width:min(72vw, 292px) !important;
    max-width:calc(100vw - 28px) !important;
    left:7px !important;
  }
}

/* In landscape, keep the drawer open while navigating or tapping outside it.
   It closes only through the explicit Hide menu toggle. */
@media (max-width:980px) and (orientation:landscape) {
  #app-sidebar.app-sidebar { width:min(42vw, 310px) !important; max-width:calc(100vw - 24px) !important; }
  .sidebar-backdrop { display:none !important; pointer-events:none !important; }
}

/* Focus indication follows the real control shape instead of a large rectangular halo. */
:where(button,a,[role="button"],input,select,textarea,.tab-btn,.nav-label):focus:not(:focus-visible) {
  outline:none !important;
  box-shadow:none !important;
}
:where(button,a,[role="button"],input,select,textarea,.tab-btn):focus-visible {
  outline:2px solid color-mix(in srgb, var(--scene-accent,var(--accent,#ff9a45)) 72%, white) !important;
  outline-offset:-2px !important;
  border-radius:inherit !important;
  box-shadow:0 0 0 2px rgba(10,14,30,.28) !important;
}
:where(button,a,[role="button"],.tab-btn) { -webkit-tap-highlight-color:transparent !important; }

/* Landscape chat: use most of the short viewport so conversation history is readable. */
@media (max-width:980px) and (orientation:landscape) {
  #ai-chat-modal.chat-modal:not(.hidden) {
    position:fixed !important;
    top:8px !important;
    bottom:8px !important;
    right:10px !important;
    left:auto !important;
    width:min(58vw,560px) !important;
    min-width:min(360px,calc(100vw - 20px)) !important;
    height:auto !important;
    max-height:none !important;
    min-height:0 !important;
    display:flex !important;
    flex-direction:column !important;
    z-index:1900 !important;
  }
  #ai-chat-modal .chat-header { flex:0 0 auto !important; }
  #ai-chat-modal .chat-messages { flex:1 1 auto !important; min-height:0 !important; overflow-y:auto !important; }
  #ai-chat-modal .chat-input-row,
  #ai-chat-modal .chat-mode-bar { flex:0 0 auto !important; }
}
@media (prefers-reduced-motion:reduce) {
  #seasonal-dashboard .seasonal-kpi.is-loading::before,
  #seasonal-dashboard .seasonal-kpi.is-loading .kpi-icon,
  #dashboard-refresh.is-loading::first-letter { animation:none !important; }
}
