
/* AI-Lab shared navigation and access cards */
.ai-global-shell{padding-top:18px;margin-bottom:30px}
.ai-app-brand{display:block;font-size:24px;line-height:1;font-weight:850;color:#edf3fb!important;text-decoration:none;margin-bottom:22px}
.ai-global-nav{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}
.ai-global-nav a{min-height:54px;display:flex;align-items:center;justify-content:center;padding:10px;border:1px solid #2b3b53;border-radius:12px;background:#0f192a;color:#cbd5e1;text-decoration:none;font-size:13px;font-weight:750;text-align:center}
.ai-global-nav a:hover{background:#17253a;color:#fff}

.ai-access-card{margin-top:16px;padding:16px;border-radius:16px;background:#0e1726;border:1px solid rgba(148,163,184,.18)}
#recovery-access-system{border-color:rgba(124,58,237,.38)}
.ai-access-title{font-size:18px;font-weight:850}
.ai-access-state{margin-top:10px;font-size:13px;color:#b8c5d6;line-height:1.5}
.ai-access-ok{color:#50dd95}.ai-access-bad{color:#ff9aa4}
.ai-access-url{display:block;margin-top:7px;color:#9fc5f8;text-decoration:none;overflow-wrap:anywhere}
.ai-access-meta{margin-top:6px;color:#8290a6;font-size:12px;line-height:1.45}
.ai-access-actions{display:flex;gap:10px;flex-wrap:wrap;margin-top:14px}
.ai-access-button{min-height:44px;padding:0 16px;border:1px solid #2b3b53;border-radius:12px;background:#111b2d;color:#edf3fb!important;text-decoration:none;font-weight:800;display:inline-flex;align-items:center;justify-content:center}
.ai-access-button.primary{background:#2463db}
.ai-access-button:disabled{opacity:.45}
.ai-access-qr{display:none;margin-top:14px;padding:12px;border-radius:12px;background:#fff;text-align:center}
.ai-access-qr.show{display:block}
.ai-access-qr img{width:220px;height:220px;max-width:100%}

.ai-current-status{display:flex;justify-content:space-between;align-items:center;gap:12px;margin:12px 0;padding:14px;border:1px solid rgba(80,221,149,.35);border-radius:16px;background:rgba(7,58,43,.36)}
.ai-current-status>a{color:#9fc5f8;text-decoration:none;white-space:nowrap}
.ai-current-meta{font-size:12px;color:#b8c5d6;margin-top:5px;line-height:1.45}
.ai-history-note{color:#8290a6;margin-top:4px}
.ai-current-meta .ok{color:#50dd95}.ai-current-meta .bad{color:#ff9aa4}

@media(max-width:520px){
  .ai-global-shell{padding-top:22px;margin-bottom:30px}
  .ai-app-brand{font-size:25px;margin-bottom:22px}
  .ai-global-nav{gap:9px}
  .ai-global-nav a{min-height:58px;font-size:12px;padding:8px}
  .ai-current-status{align-items:flex-start;flex-direction:column}
  .ai-access-actions{display:grid;grid-template-columns:1fr}
  .ai-access-button{width:100%}
}

/* Pull to Refresh for the main AI-Lab */
.ai-access-neutral{color:#f4c76b}
.ai-pull-refresh{
  position:fixed;
  left:50%;
  top:calc(env(safe-area-inset-top) + 8px);
  z-index:10000;
  transform:translate(-50%,-76px);
  opacity:0;
  display:flex;
  align-items:center;
  gap:9px;
  min-height:42px;
  padding:0 14px;
  border-radius:999px;
  background:rgba(15,25,42,.97);
  border:1px solid #2b3b53;
  color:#cbd5e1;
  font-size:12px;
  font-weight:750;
  box-shadow:0 10px 30px rgba(0,0,0,.4);
  pointer-events:none;
  transition:transform .14s ease,opacity .14s ease;
}
.ai-pull-refresh.ready{border-color:#2463db;color:#fff}
.ai-pull-spinner{
  width:16px;
  height:16px;
  border-radius:50%;
  border:2px solid rgba(255,255,255,.25);
  border-top-color:#fff;
}
.ai-pull-refresh.refreshing .ai-pull-spinner{
  animation:ai-pull-spin .8s linear infinite;
}
@keyframes ai-pull-spin{to{transform:rotate(360deg)}}


/* Artifact UX Contract: every file action stays inside an explicit AI-Lab sheet first */
html.ai-artifact-lock{overflow:hidden}
.ai-artifact-overlay{
  position:fixed;
  inset:0;
  z-index:30000;
  display:flex;
  align-items:flex-end;
  justify-content:center;
  padding:18px;
  padding-bottom:calc(18px + env(safe-area-inset-bottom));
  background:rgba(2,6,14,.82);
  backdrop-filter:blur(10px);
}
.ai-artifact-sheet{
  width:min(620px,100%);
  max-height:calc(100vh - 36px - env(safe-area-inset-top));
  overflow:auto;
  padding:18px;
  border:1px solid #2b3b53;
  border-radius:22px;
  background:#0e1726;
  color:#edf3fb;
  box-shadow:0 28px 80px rgba(0,0,0,.55);
}
.ai-artifact-head{display:flex;align-items:flex-start;justify-content:space-between;gap:14px}
.ai-artifact-head h2{margin:4px 0 0;font-size:22px;line-height:1.15}
.ai-artifact-kicker{font-size:10px;font-weight:850;letter-spacing:.12em;color:#7faef6}
.ai-artifact-head-actions{display:flex;align-items:center;gap:8px}
.ai-artifact-icon{
  width:44px;height:44px;display:grid;place-items:center;flex:0 0 44px;
  border:1px solid #334763;border-radius:12px;background:#111b2d;color:#edf3fb;
  font-size:30px;line-height:1;font-weight:400;
}
.ai-artifact-icon svg{width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:1.9;stroke-linecap:round;stroke-linejoin:round}
.ai-artifact-icon.close{font-size:29px;padding-bottom:3px}
.ai-artifact-file{margin-top:18px;padding:14px;border:1px solid rgba(148,163,184,.16);border-radius:14px;background:#091321}
.ai-artifact-name{font-size:15px;font-weight:800;overflow-wrap:anywhere}
.ai-artifact-meta{margin-top:6px;color:#8fa0b7;font-size:12px}
.ai-artifact-actions{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:9px;margin-top:14px}
.ai-artifact-button{
  min-height:48px;padding:0 12px;border:1px solid #334763;border-radius:12px;
  background:#111b2d;color:#edf3fb;font-weight:800;font-size:13px;
}
.ai-artifact-button.primary{background:#2463db}
.ai-artifact-state{margin-top:13px;padding:11px 12px;border-radius:11px;background:#091321;color:#9fb0c6;font-size:12px;line-height:1.45}
.ai-artifact-state.busy{color:#f4c76b}.ai-artifact-state.ok{color:#72e7aa}.ai-artifact-state.warn{color:#f4c76b}.ai-artifact-state.bad{color:#ff9aa4}
@media(max-width:520px){
  .ai-artifact-overlay{padding:10px;padding-bottom:calc(10px + env(safe-area-inset-bottom))}
  .ai-artifact-sheet{border-radius:20px;padding:15px}
  .ai-artifact-actions{grid-template-columns:1fr}
  .ai-artifact-button{width:100%}
}

/* Interaction Feedback Contract v3 */
button.ai-feedback-success,.ai-feedback-success{background:#12613f!important;border-color:#2a8d64!important;color:#eafff3!important}
button.ai-feedback-error,.ai-feedback-error{background:#55202b!important;border-color:#8f3747!important;color:#ffe8eb!important}
button[aria-busy="true"]{cursor:progress}

/* PWA standalone navigation/scroll boundary */
html,body{min-height:100%;overflow-y:auto;-webkit-overflow-scrolling:touch;}
body{touch-action:pan-y;}
@media (display-mode:standalone){html,body{height:auto;min-height:100%;overflow-y:auto;}}
