/* ============================================================
   MITHRA 2026 — Interactive Product Tour
   Attio-style pattern: a row of feature tabs above a single
   persistent app-shell window. Switching a tab swaps only the
   main panel; the sidebar (workspace + search + nav) stays put.
   Product colorway (blues) — this is product chrome, not
   marketing chrome.
   ============================================================ */

.tour { position: relative; }

/* ---- backdrop: faint dotted field the window floats on ---- */
.tour-stage-bg {
  position: relative;
  padding: 8px 0 0;
}

/* ============================================================
   1 · FEATURE TAB BAR  (sits above the window)
   ============================================================ */
.pw-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-bottom: 1px solid var(--soft-border);
  margin-bottom: clamp(28px, 4vw, 48px);
  position: relative;
}
/* auto-advance loading bar — slides under the active tab and fills over its dwell */
.pw-progress {
  position: absolute; bottom: -1px; left: 0; width: 0; height: 2px;
  background: rgba(0, 0, 0, .1);
  transition: left .4s var(--ease), width .4s var(--ease);
  pointer-events: none;
}
.pw-progress > i { display: block; height: 100%; width: 0; background: var(--ink); }
.pw-tabs.pw-auto .pw-tab.active::after { display: none; }   /* the bar replaces the static underline */
.pw-tab {
  appearance: none;
  border: 0; background: none;
  border-left: 1px solid var(--soft-border);
  padding: 14px 14px 16px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: clamp(13.5px, 1.05vw, 16px);
  letter-spacing: -0.01em;
  color: var(--slate);
  text-align: center;
  position: relative;
  transition: color .18s var(--ease);
}
.pw-tab:first-child { border-left: 0; }
.pw-tab:hover { color: var(--ink); }
.pw-tab.active { color: var(--ink); }
.pw-tab.active::after {
  content: "";
  position: absolute; left: 0; right: 0; bottom: -1px;
  height: 2px; background: var(--ink);
}
.pw-tab .pw-tab-sub {
  display: block;
  font-weight: 500;
  font-size: 12.5px;
  letter-spacing: 0;
  color: var(--slate-light);
  margin-top: 5px;
}
@media (max-width: 760px) {
  .pw-tabs { grid-template-columns: 1fr 1fr; gap: 0; }
  .pw-tab:nth-child(3) { border-left: 0; }
  .pw-tab { border-top: 1px solid var(--soft-border); }
  .pw-tab:nth-child(-n+2) { border-top: 0; }
  .pw-tab .pw-tab-sub { display: none; }
}

/* ============================================================
   2 · APP-SHELL WINDOW
   ============================================================ */
.appwin {
  --aw-border: #EAECF1;
  --aw-side-bg: #FAFAFC;
  --aw-muted: #6B7280;
  display: grid;
  grid-template-columns: 234px 1fr;
  grid-template-rows: auto 1fr;
  background: #fff;
  border: 1px solid var(--aw-border);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  height: 600px;
  font-family: var(--font-body);
  color: var(--ink);
}
@media (max-width: 860px) {
  .appwin { grid-template-columns: 1fr; height: 70vh; min-height: 480px; }
}

/* ---- 0 · full-width top bar ---- */
.aw-topbar {
  grid-column: 1 / -1;
  display: flex; align-items: stretch;
  height: 52px; flex: 0 0 auto;
  background: #fff;
  border-bottom: 1px solid var(--aw-border);
}
.aw-tb-brandzone {
  width: 234px; flex: 0 0 auto;
  display: flex; align-items: center;
  padding: 0 14px;
}
@media (max-width: 860px) { .aw-tb-brandzone { width: auto; } }
.aw-tb-brandzone .aw-collapse { margin: 0; }
.aw-tb-bar {
  flex: 1; min-width: 0;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px;
}
.aw-ws {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  background: none; border: 0; padding: 0;
  font-family: var(--font-head); font-weight: 600; font-size: 15px;
  color: var(--ink); letter-spacing: -0.01em;
}
.aw-ws .aw-ws-name { padding-bottom: 3px; border-bottom: 2px solid var(--ink); }
.aw-tb-bar .aw-ws, .aw-tb-bar .aw-ws-name { font-size: 11.5px; }   /* topbar workspace name — smaller (override the bare .aw-ws-name rule) */
.aw-ws .aw-ws-chev { width: 14px; height: 14px; color: var(--aw-muted); display: inline-flex; }
.aw-tb-actions { display: flex; align-items: center; gap: 6px; }
.aw-tb-acct {
  position: relative; appearance: none; border: 0; background: none; cursor: pointer;
  width: 34px; height: 34px; border-radius: 8px;
  display: grid; place-items: center; color: #6b7280;
  transition: background .14s, color .14s;
}
.aw-tb-acct:hover { background: #F1F2F6; color: var(--ink); }
.aw-tb-acct svg { width: 22px; height: 22px; }
.aw-tb-badge {
  position: absolute; top: 0; right: 0;
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 999px; background: #E5484D; color: #fff;
  font-family: var(--font-body); font-size: 10px; font-weight: 700;
  display: grid; place-items: center; line-height: 1;
  border: 1.5px solid #fff;
}

/* ---- 2a · sidebar (Mithra module rail) ---- */
.aw-side {
  background: #fff;
  border-right: 1px solid var(--aw-border);
  padding: 14px 12px 18px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto; scrollbar-width: none;
}
.aw-side::-webkit-scrollbar { width: 0; }
@media (max-width: 860px) { .aw-side { display: none; } }

/* collapse / panel toggle (top of rail) */
.aw-collapse {
  appearance: none; border: 0; background: none; cursor: pointer;
  width: 30px; height: 30px; border-radius: 7px;
  display: grid; place-items: center; color: #6b7280;
  margin: 0 0 4px 2px;
  transition: background .14s, color .14s;
}
.aw-collapse:hover { background: #F1F2F6; color: var(--ink); }
.aw-collapse svg { width: 20px; height: 20px; }

/* brand lockup */
.aw-brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 14px; }
.aw-brand img { height: 28px; width: auto; display: block; }
.aw-brand .aw-brand-fallback { font-family: var(--font-head); font-weight: 700; font-size: 21px; color: var(--ink); letter-spacing: -0.02em; }

/* workspace switcher */
.aw-ws {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 8px 8px 6px;
  border-radius: 9px;
}
.aw-ws:hover { background: #F1F2F6; }
.aw-ws-mark {
  width: 28px; height: 28px; border-radius: 8px; flex: 0 0 auto;
  background: var(--ink); color: #fff;
  display: grid; place-items: center;
  font-family: var(--font-head); font-weight: 700; font-size: 14px;
}
.aw-ws-name {
  font-family: var(--font-head); font-weight: 600; font-size: 15px;
  color: var(--ink); flex: 1; letter-spacing: -0.01em;
}
.aw-ws .aw-chev { width: 15px; height: 15px; color: var(--aw-muted); }
.aw-ws .aw-panel-ic { width: 17px; height: 17px; color: #B6BAC4; }

/* quick-actions search */
.aw-search {
  display: flex; align-items: center; gap: 9px;
  margin: 10px 0 6px;
  padding: 8px 9px;
  border: 1px solid var(--aw-border);
  background: #fff;
  border-radius: 9px;
  color: var(--aw-muted);
  font-size: 13.5px; font-weight: 500;
}
.aw-search .aw-search-ic { width: 16px; height: 16px; color: #9AA0AC; }
.aw-search-label { flex: 1; }
.aw-kbd {
  font-family: var(--font-body); font-size: 11px; font-weight: 600;
  color: var(--aw-muted);
  background: #F1F2F6; border: 1px solid var(--aw-border);
  border-radius: 5px; padding: 2px 6px; line-height: 1;
}

/* nav */
.aw-nav { display: flex; flex-direction: column; gap: 0; margin-top: 0; }
.aw-nav-label {
  font-size: 10.5px; font-weight: 700; letter-spacing: .09em;
  text-transform: uppercase; color: #A2A8B4;
  padding: 17px 10px 7px;
}
.aw-nav a {
  position: relative;
  display: flex; align-items: center; gap: 11px;
  padding: 12px 10px; border-radius: 8px;
  font-size: 13.5px; font-weight: 500; color: #2f3540;
  white-space: nowrap;
  transition: background .14s, color .14s;
}
.aw-nav a:hover { background: #F4F4F7; color: var(--ink); }
.aw-nav a.active { background: #EAEAF1; color: var(--ink); font-weight: 600; }
/* group break (separates the two nav groups) */
.aw-nav-sep { height: 1px; flex: 0 0 auto; background: var(--aw-border); margin: 9px 12px; }
.aw-nav a .aw-ic { width: 19px; height: 19px; flex: 0 0 auto; color: #6b7280; }
.aw-nav a.active .aw-ic { color: var(--ink); }
.aw-nav a:hover .aw-ic { color: #3c4250; }
.aw-nav a .aw-count {
  margin-left: auto; font-size: 11px; font-weight: 600;
  color: var(--aw-muted); background: #ECEEF2;
  border-radius: 999px; padding: 1px 7px; min-width: 20px; text-align: center;
}
.aw-side-foot { margin-top: auto; padding-top: 10px; }
.aw-user {
  display: flex; align-items: center; gap: 10px;
  padding: 8px; border-radius: 9px;
}
.aw-user:hover { background: #F1F2F6; }
.aw-user-av {
  width: 28px; height: 28px; border-radius: 50%; flex: 0 0 auto;
  background: linear-gradient(140deg, #4589FF, #0F62FE); color: #fff;
  display: grid; place-items: center; font-size: 12px; font-weight: 600;
}
.aw-user-name { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.aw-user-mail { font-size: 11.5px; color: var(--aw-muted); }

/* ---- 2b · main panel ---- */
.aw-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }

/* panel header */
.aw-top {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 22px;
  border-bottom: 1px solid var(--aw-border);
}
.aw-title {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-head); font-weight: 600; font-size: 17px;
  color: var(--ink); letter-spacing: -0.01em;
}
.aw-title .aw-title-ic {
  width: 20px; height: 20px; color: var(--really-blue);
}
.aw-top-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.aw-help {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 13.5px; font-weight: 500; color: var(--aw-muted);
}
.aw-help svg { width: 16px; height: 16px; }

/* sub-toolbar (segmented controls, filters, live toggle …) */
.aw-toolbar {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 22px;
  border-bottom: 1px solid var(--aw-border);
  flex-wrap: wrap;
}
.aw-seg {
  display: inline-flex; align-items: center; gap: 2px;
  background: #F1F2F6; border-radius: 9px; padding: 3px;
}
.aw-seg button {
  appearance: none; border: 0; background: none;
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--font-body); font-size: 13px; font-weight: 600;
  color: var(--aw-muted); padding: 6px 12px; border-radius: 7px;
  transition: background .14s, color .14s;
}
.aw-seg button svg { width: 15px; height: 15px; }
.aw-seg button.on { background: #fff; color: var(--ink); box-shadow: var(--shadow-xs); }
.aw-seg .aw-seg-count {
  font-size: 11px; font-weight: 600; color: var(--aw-muted);
  background: #E4E7ED; border-radius: 999px; padding: 1px 6px;
}

.aw-chip {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 13px; font-weight: 500; color: #3C4250;
  background: #fff; border: 1px solid var(--aw-border);
  border-radius: 8px; padding: 7px 12px;
}
.aw-chip svg { width: 15px; height: 15px; color: var(--aw-muted); }
.aw-chip .aw-chev { width: 14px; height: 14px; }

.aw-btn {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--font-body); font-size: 13px; font-weight: 600;
  border-radius: 8px; padding: 8px 13px; border: 1px solid transparent;
  transition: background .14s, border-color .14s;
}
.aw-btn svg { width: 15px; height: 15px; }
.aw-btn-primary { background: var(--really-blue); color: #fff; }
.aw-btn-primary:hover { background: var(--rich-cold); }
.aw-btn-ghost { background: #fff; border-color: var(--aw-border); color: #3C4250; }
.aw-btn-ghost:hover { border-color: #C8CCD6; color: var(--ink); }

/* live toggle */
.aw-live {
  display: inline-flex; align-items: center; gap: 9px;
  background: var(--green-bg); border: 1px solid #BFE6CB;
  border-radius: 999px; padding: 4px 5px 4px 12px;
  font-size: 12.5px; font-weight: 600; color: #1c7d40;
}
.aw-live .aw-live-dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--green);
  box-shadow: 0 0 0 3px rgba(36,161,72,.18);
}
.aw-switch {
  width: 34px; height: 19px; border-radius: 999px;
  background: var(--green); position: relative; flex: 0 0 auto;
}
.aw-switch::after {
  content: ""; position: absolute; top: 2px; right: 2px;
  width: 15px; height: 15px; border-radius: 50%; background: #fff;
}
.aw-spacer { margin-left: auto; }

/* ---- 2c · the demo stage (where each demo gets built) ---- */
.aw-stage {
  flex: 1; position: relative; min-height: 380px;
  background:
    radial-gradient(circle at 1px 1px, #E4E7EE 1px, transparent 0) 0 0 / 22px 22px,
    #FCFCFD;
  display: flex; align-items: center; justify-content: center;
  padding: 32px;
}
.aw-stage-ph {
  display: inline-flex; flex-direction: column; align-items: center;
  gap: 12px; text-align: center;
}
.aw-stage-ph .aw-ph-badge {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: "Roboto Mono", ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12px; font-weight: 500; letter-spacing: .02em;
  color: var(--aw-muted);
  background: #fff; border: 1px solid var(--aw-border);
  border-radius: 999px; padding: 8px 15px;
  box-shadow: var(--shadow-xs);
}
.aw-stage-ph .aw-ph-badge .aw-ph-diamond {
  width: 9px; height: 9px; background: var(--really-blue);
  transform: rotate(45deg); border-radius: 1px;
}
.aw-stage-ph .aw-ph-title {
  font-family: var(--font-head); font-weight: 600; font-size: 19px;
  color: var(--ink); letter-spacing: -0.01em;
}
.aw-stage-ph .aw-ph-note {
  font-size: 13.5px; color: var(--aw-muted); max-width: 340px;
  line-height: 1.5;
}

/* panel show / hide */
.pw-panel { display: none; }
.pw-panel.active { display: flex; flex-direction: column; flex: 1; min-width: 0; min-height: 0; }
html.anim-off .pw-panel.active { animation: none; }
.pw-panel.active { animation: tourFade .4s var(--ease); }
@keyframes tourFade { from { opacity: 0; } to { opacity: 1; } }

/* ============================================================
   MOBILE — scale the hero product window down as a faithful
   miniature instead of reflowing it. js/tour-scale.js sizes
   .tour-stage-bg to DESIGN px and transform:scale()s it to fit.
   These rules (a) close both side menus and (b) PIN the inner
   content to its desktop layout so the miniature reads like the
   real product. Scoped to .imm-tour so standalone product pages
   keep their normal responsive reflow.
   ============================================================ */
@media (max-width: 760px) {
  /* close the two side menus */
  .imm-tour .aw-side,
  .imm-tour .ac-history { display: none; }
  .imm-tour .appwin { grid-template-columns: 1fr; height: 600px; min-height: 0; }
  .imm-tour .ac-layout { grid-template-columns: 1fr; }

  /* feature tabs → readable 2×2 grid (not scaled with the window) */
  .imm-tour .pw-tabs { grid-template-columns: 1fr 1fr; }
  .imm-tour .pw-tab { border-top: 1px solid rgba(255,255,255,.14); }
  .imm-tour .pw-tab:nth-child(-n+2) { border-top: 0; }
  .imm-tour .pw-tab:nth-child(3) { border-left: 0; }
  .imm-tour .pw-tab .pw-tab-sub { display: block; }

  /* pin Opportunity Intelligence to its full desktop table */
  .imm-tour .opp-kpis { grid-template-columns: repeat(4, 1fr); }
  .imm-tour .opp-views { display: flex; }
  .imm-tour .opp-head,
  .imm-tour .opp-row { grid-template-columns: minmax(220px,2.3fr) minmax(150px,1.3fr) 112px 96px 92px; }
  .imm-tour .opp-head .h-src { display: block; }
  .imm-tour .opp-row .opp-src { display: inline-flex; }

  /* pin Auto categorization to its full desktop table */
  .imm-tour .acat-kpis { grid-template-columns: repeat(3, 1fr); }
  .imm-tour .acat-head,
  .imm-tour .acat-sup,
  .imm-tour .acat-txn { grid-template-columns: 22px minmax(150px,1.4fr) 86px minmax(210px,1.8fr) 52px; }
  .imm-tour .acat-head .h-cat,
  .imm-tour .acat-sup .acat-cat-cell { display: block; }

  /* pin chat supplier bars to desktop widths */
  .imm-tour .ac-bar { grid-template-columns: 168px 1fr 64px; }
}

/* ----------------------------------------------------------------
   Auto Categorization: match the Opportunity panel's density inside
   the tour window (the standalone page keeps the larger sizing).
   ---------------------------------------------------------------- */
.imm-tour .acat-top { padding: 6px 22px 2px; gap: 12px; }
.imm-tour .acat-title { font-size: 15px; }
.imm-tour .acat-btn { font-size: 12px; padding: 6px 11px; }
.imm-tour .acat-btn svg { width: 14px; height: 14px; }
.imm-tour .acat-kpis { gap: 10px; padding: 4px 22px 8px; }
.imm-tour .acat-kpi { padding: 6px 12px; border-radius: 12px; }
.imm-tour .acat-kpi-l { font-size: 11px; }
.imm-tour .acat-kpi-n { margin-top: 3px; font-size: 16px; }
.imm-tour .acat-toolbar { padding: 7px 22px; font-size: 11.5px; }
.imm-tour .acat-head { height: 26px; top: 31px; font-size: 10.5px; }
.imm-tour .acat-sup { min-height: 32px; }
.imm-tour .acat-sup-name { font-size: 12.5px; }
.imm-tour .acat-spend { font-size: 12px; }
.imm-tour .acat-score { font-size: 12.5px; }
.imm-tour .acat-chip { font-size: 11px; padding: 2px 9px; }
.imm-tour .acat-uncat { font-size: 11px; padding: 2px 9px; }
.imm-tour .acat-txn { padding: 10px 22px; }
.imm-tour .acat-txn-reason { font-size: 11.5px; line-height: 1.45; }
