/* ============================================
   NEURAPHIC WORKERS — app-shell.css
   Authenticated /app/ topbar, sections, callouts,
   and page-local utilities extracted from inline
   <style> blocks so CSP (no unsafe-inline) holds.

   Tokens used only: --bg, --black, --gray, --head,
   --sans, --line, --w (all from base.css).
   ============================================ */

/* --- App topbar ------------------------------------------------- */
.app-topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  height: 56px;
  background: rgba(240,241,243,0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}
.app-topbar__inner {
  max-width: 100%;
  height: 100%;
  padding: 0 clamp(16px, 2.4vw, 28px);
  display: grid;
  grid-template-columns: 240px 1fr auto;
  align-items: center;
  gap: 16px;
}
.app-topbar__brand {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  text-decoration: none;
  color: var(--black);
}
.app-topbar__brand-name {
  font-family: var(--head);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  color: var(--black);
}
.app-topbar__brand-sub {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
  color: var(--gray);
  letter-spacing: 0;
}
.app-topbar__crumb {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--gray);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.app-topbar__crumb strong {
  color: var(--black);
  font-weight: 600;
}
.app-topbar__right {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.app-topbar__icon-btn {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  color: var(--black);
  border-radius: 8px;
  cursor: pointer;
  transition: background .15s, opacity .15s;
}
.app-topbar__icon-btn:hover { background: rgba(19,19,20,0.06); }
.app-topbar__icon-btn svg { width: 16px; height: 16px; }
.app-topbar__avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--black);
  color: var(--bg);
  font-family: var(--head);
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 4px;
  text-decoration: none;
  letter-spacing: 0;
}
.app-topbar__avatar:hover { opacity: 0.85; }

/* Push layouts down below the fixed topbar --------------------- */
body[data-page] .layout { padding-top: 56px; }
body[data-page] .sidebar { top: 56px; }
body[data-page] .ops { padding-top: 56px; }

/* --- App section (label column + content) --------------------- */
.app-section {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: clamp(20px, 3vw, 44px);
  padding: 28px 0;
  border-top: 1px solid var(--line);
}
.app-section:first-of-type { border-top: 0; padding-top: 8px; }
.app-section__label {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  color: var(--gray);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding-top: 4px;
}
.app-section__label small {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  font-weight: 400;
  color: var(--gray);
  text-transform: none;
  letter-spacing: 0;
  line-height: 1.5;
  max-width: 160px;
}
.app-section__content { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

@media (max-width: 820px) {
  .app-section { grid-template-columns: 1fr; gap: 12px; }
  .app-section__label small { max-width: none; }
}

/* --- Dark callout inside /app/ -------------------------------- */
.app-callout--dark {
  background: var(--black);
  color: var(--bg);
  border-radius: 14px;
  padding: clamp(20px, 3vw, 28px);
  border: 1px solid var(--black);
}
.app-callout--dark h3,
.app-callout--dark .card__title {
  font-family: var(--head);
  font-size: 18px;
  font-weight: 600;
  color: var(--bg);
  letter-spacing: -0.01em;
  margin: 0 0 6px;
}
.app-callout--dark p,
.app-callout--dark .card__meta {
  color: rgba(240,241,243,0.65);
  font-size: 14px;
  line-height: 1.55;
  margin: 0 0 14px;
}
.app-callout--dark .btn--ghost {
  background: transparent;
  color: var(--bg);
  border: 1px solid rgba(240,241,243,0.3);
}
.app-callout--dark .btn--ghost:hover { background: rgba(240,241,243,0.08); }

/* --- Generic helper classes (replace inline style="…") -------- */
.u-row-gap-8 { display: flex; gap: 8px; }
.u-row-gap-12 { display: flex; align-items: center; gap: 12px; }
.u-text-xs-muted { font-size: 12px; color: var(--gray); }
.u-text-hint { font-size: 11px; color: var(--gray); }
.u-back-link { margin-bottom: 16px; display: inline-block; }
.u-mt-10 { margin-top: 10px; }
.u-mt-12 { margin-top: 12px; }
.u-mt-20 { margin-top: 20px; }
.u-m-0 { margin: 0; }
.u-danger-outline {
  margin-top: 12px;
  border-color: #c03838;
  color: #c03838;
}
.section-heading-sm {
  font-family: var(--head);
  color: var(--black);
  font-size: 13px;
  margin: 16px 0 8px;
  font-weight: 600;
  letter-spacing: -0.005em;
}
.section-heading-sm--spaced { margin: 24px 0 8px; }

/* --- Onboarding wizard (from onboarding.html) ----------------- */
.wizard { max-width: 720px; margin: 40px auto; padding: 0 16px; }
.wizard__progress { display: flex; align-items: center; gap: 8px; margin-bottom: 32px; }
.wizard__dot { flex: 1; height: 4px; background: #dddee1; border-radius: 2px; overflow: hidden; }
.wizard__dot--done > span,
.wizard__dot--current > span { background: var(--black); }
.wizard__dot > span { display: block; height: 100%; width: 0; background: var(--black); transition: width 280ms ease; }
.wizard__dot--done > span { width: 100%; }
.wizard__dot--current > span { width: 50%; }
.wizard__step-label { font-size: 12px; color: var(--gray); letter-spacing: 0.04em; text-transform: uppercase; margin-bottom: 8px; }
.wizard__panel { display: none; }
.wizard__panel[data-active="true"] { display: block; }
.wizard__nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 24px; }
.wizard__nav--end { justify-content: flex-end; margin-top: 20px; }

.examples { list-style: none; padding: 0; margin: 12px 0 0; display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--gray); }
.examples li::before { content: "— "; }

/* Onboarding uses .tools-grid/.tool-tile/.drawer; no collision because
   tools.css (which defines same names) is not loaded on onboarding.html. */
body[data-page="onboarding"] .tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px; margin-top: 16px;
}
body[data-page="onboarding"] .tool-tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; padding: 18px 12px;
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  cursor: pointer;
  transition: border-color 140ms ease, transform 140ms ease;
  font: inherit; color: inherit;
}
body[data-page="onboarding"] .tool-tile:hover { border-color: var(--black); transform: translateY(-1px); }
body[data-page="onboarding"] .tool-tile[aria-pressed="true"] {
  border-color: var(--black); box-shadow: inset 0 0 0 1px var(--black);
}
body[data-page="onboarding"] .tool-tile__glyph {
  width: 40px; height: 40px; border-radius: 10px; background: #f0f1f3;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--head); font-weight: 600; font-size: 15px; letter-spacing: 0.02em;
}
body[data-page="onboarding"] .tool-tile__glyph--lg { width: 56px; height: 56px; font-size: 18px; }
body[data-page="onboarding"] .tool-tile__name { font-size: 13px; font-weight: 500; }

body[data-page="onboarding"] .drawer { position: fixed; inset: 0; display: none; z-index: 50; }
body[data-page="onboarding"] .drawer[data-open="true"] { display: block; }
body[data-page="onboarding"] .drawer__scrim { position: absolute; inset: 0; background: rgba(19,19,20,0.32); }
body[data-page="onboarding"] .drawer__panel {
  position: absolute; top: 0; right: 0; bottom: 0;
  width: min(420px, 100%);
  background: var(--bg); padding: 32px 28px;
  overflow-y: auto;
  box-shadow: -12px 0 48px rgba(19,19,20,0.12);
  display: flex; flex-direction: column;
}
body[data-page="onboarding"] .drawer__close {
  align-self: flex-end; background: none; border: 0;
  font-size: 22px; cursor: pointer; color: var(--gray);
}
.onb-drawer__title { margin: 16px 0 4px; font-family: var(--head); font-weight: 600; letter-spacing: -0.01em; font-size: 18px; }
.onb-drawer__desc { margin: 0 0 20px; }
.onb-drawer__glyph-lg { width: 56px; height: 56px; font-size: 18px; }

.nera-card {
  background: #fff; border: 1px solid var(--line); border-radius: 16px;
  padding: 32px;
  display: flex; flex-direction: column; align-items: center;
  text-align: center; gap: 16px;
}
.nera-avatar {
  width: 96px; height: 96px; border-radius: 50%;
  background: var(--black); color: var(--bg);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--head); font-size: 42px; font-weight: 600;
}
.nera-msg {
  background: #f0f1f3; padding: 16px 20px; border-radius: 14px;
  font-size: 15px; line-height: 1.6; max-width: 420px;
}

/* --- Tools detail page (from tools-detail.html) --------------- */
.detail-wrap { padding-top: 32px; padding-bottom: 56px; }
.detail-hero {
  display: flex; gap: 20px; align-items: flex-start;
  padding-bottom: 24px; border-bottom: 1px solid var(--line);
  margin-bottom: 24px;
}
.detail-hero .tool-tile { width: 64px; height: 64px; font-size: 28px; border-radius: 14px; }
.detail-hero h1 {
  font-family: var(--head); font-size: clamp(28px, 3vw, 36px); font-weight: 700;
  margin: 0 0 8px; letter-spacing: -0.02em; color: var(--black);
}
.detail-hero p {
  font-family: var(--sans); font-size: 16px; color: var(--gray);
  margin: 0; max-width: 640px;
}
.detail-cta { margin-top: 20px; display: flex; gap: 12px; }
.detail-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 24px; }
.meta-grid--single { grid-template-columns: 1fr; }
.meta-grid__value--cap { text-transform: capitalize; }
@media (max-width: 720px) {
  .detail-grid { grid-template-columns: 1fr; }
}

/* --- OAuth callback page (from tools-oauth-callback.html) ----- */
.callback-wrap {
  min-height: 100vh;
  display: grid; place-items: center;
  padding: 24px;
  background: var(--bg);
}
.callback-card {
  max-width: 460px; width: 100%;
  background: #fff; border: 1px solid var(--line);
  border-radius: 14px; padding: 36px;
  text-align: center;
}
.callback-card h1 {
  font-family: var(--head); font-size: 24px; font-weight: 700;
  color: var(--black); margin: 0 0 12px;
  letter-spacing: -0.01em;
}
.callback-card p {
  font-family: var(--sans); font-size: 15px; color: var(--gray);
  margin: 0 0 20px; line-height: 1.55;
}
.callback-spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--line);
  border-top-color: var(--black);
  border-radius: 50%;
  animation: app-spin 0.8s linear infinite;
  margin: 0 auto 20px;
}
.callback-card .btn--primary { width: 100%; }
.callback-card .is-hidden { display: none; }
@keyframes app-spin { to { transform: rotate(360deg); } }

/* --- Mobile tweaks for topbar --------------------------------- */
@media (max-width: 820px) {
  .app-topbar__inner { grid-template-columns: auto 1fr auto; }
  .app-topbar__brand-sub { display: none; }
  .app-topbar__crumb { font-size: 12px; }
}
