/* Rallio Coach — embedded app shell (desktop "studio" + phone "app" views).
   Loaded only inside coach-screen.html (iframed by the marketing pages), so it
   styles the shell chrome around the real @rallio/coach-ui page blocks. Tokens
   come from the coach design system (var(--bg)/--surface/--ink/--accent/…). */

html, body { height: 100%; }
body { background: var(--bg); overflow: hidden; }
#root { height: 100vh; }

/* ════════════════════════ DESKTOP STUDIO (view=app) ════════════════════════ */
.capp { display: flex; height: 100vh; min-height: 0; background: var(--bg); }

/* ── Grouped sidebar menu ─────────────────────────────────────────────── */
.capp__side {
  width: 252px; flex-shrink: 0; background: var(--surface);
  border-right: 1px solid var(--line); display: flex; flex-direction: column;
}
.capp__brand {
  display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px;
}
.capp__logo {
  width: 34px; height: 34px; border-radius: 10px; background: var(--accent);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.capp__word {
  font-family: Archivo, sans-serif; font-weight: 900; font-size: 19px;
  letter-spacing: 1px; color: var(--ink); line-height: 1;
}
.capp__badge {
  font-family: 'Space Mono', monospace; font-weight: 700; font-size: 9px;
  letter-spacing: 1.5px; color: var(--accent-text); align-self: flex-start; margin-top: 2px;
}
.capp__nav { flex: 1; overflow-y: auto; padding: 6px 12px 12px; }
.capp__nav::-webkit-scrollbar { width: 0; }
.capp__group { margin-top: 14px; }
.capp__group:first-child { margin-top: 4px; }
.capp__glabel {
  font-family: 'Space Mono', monospace; font-weight: 700; font-size: 10px;
  letter-spacing: 1.4px; text-transform: uppercase; color: var(--mute);
  padding: 0 12px 7px;
}
.capp__item {
  display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 9px 12px; border-radius: 11px; border: none; cursor: pointer;
  background: transparent; color: var(--ink-soft); text-align: left;
  font-family: Archivo, sans-serif; font-weight: 600; font-size: 13.5px;
  transition: background .14s, color .14s; margin-bottom: 2px;
}
.capp__item:hover { background: var(--surface-2); color: var(--ink); }
.capp__item.is-active {
  background: var(--accent-wash); color: var(--accent-text); font-weight: 800;
}
.capp__item .lbl { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.capp__pill {
  min-width: 19px; height: 19px; padding: 0 6px; border-radius: 999px;
  background: var(--accent); color: #fff; font-family: 'Space Mono', monospace;
  font-weight: 700; font-size: 10.5px; display: flex; align-items: center; justify-content: center;
}
.capp__me {
  display: flex; align-items: center; gap: 10px; padding: 13px 16px;
  border-top: 1px solid var(--line); flex-shrink: 0;
}
.capp__me .nm { font-family: Archivo, sans-serif; font-weight: 700; font-size: 13px; color: var(--ink); line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.capp__me .rl { font-family: 'Hanken Grotesk', sans-serif; font-size: 11.5px; color: var(--mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Main column ──────────────────────────────────────────────────────── */
.capp__main { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }
.capp__head {
  display: flex; align-items: center; gap: 14px; padding: 16px 28px;
  border-bottom: 1px solid var(--line); flex-shrink: 0; background: var(--surface);
}
.capp__htext { flex: 1; min-width: 0; }
.capp__title {
  margin: 0; font-family: Archivo, sans-serif; font-weight: 900; font-size: 23px;
  letter-spacing: -0.5px; color: var(--ink); line-height: 1.05;
}
.capp__sub { margin: 3px 0 0; font-family: 'Hanken Grotesk', sans-serif; font-size: 13px; color: var(--mute); }
.capp__hbtn {
  width: 38px; height: 38px; border-radius: 11px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink-soft); cursor: pointer;
  display: flex; align-items: center; justify-content: center; position: relative; flex-shrink: 0;
}
.capp__hbtn:hover { background: var(--surface-2); color: var(--ink); }
.capp__hbtn .dot {
  position: absolute; top: 8px; right: 9px; width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent); border: 2px solid var(--surface);
}
.capp__scroll { flex: 1; overflow-y: auto; padding: 26px 28px 40px; background: var(--bg); }

/* mobile topbar (hidden on desktop) */
.capp__topbar { display: none; }
.capp__scrim { display: none; }

/* ── Responsive: collapse the rail into a drawer under 860px ──────────── */
@media (max-width: 860px) {
  .capp__side {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 40;
    transform: translateX(-100%); transition: transform .22s ease;
    box-shadow: 0 24px 60px -20px var(--shadow-color);
  }
  .capp.is-open .capp__side { transform: translateX(0); }
  .capp.is-open .capp__scrim {
    display: block; position: fixed; inset: 0; z-index: 35;
    background: rgba(0,0,0,.42); animation: wfade .2s ease;
  }
  .capp__topbar {
    display: flex; align-items: center; gap: 12px; padding: 12px 16px;
    border-bottom: 1px solid var(--line); background: var(--surface); flex-shrink: 0;
  }
  .capp__menubtn {
    width: 40px; height: 40px; border-radius: 11px; border: 1px solid var(--line);
    background: var(--surface); color: var(--ink); cursor: pointer;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  }
  .capp__head { display: none; }
  .capp__scroll { padding: 18px 16px 36px; }
  .capp__tbtitle { font-family: Archivo, sans-serif; font-weight: 800; font-size: 16px; color: var(--ink); }
}

/* ════════════════════════ PHONE APP (view=screen) ═════════════════════════ */
.cscreen { display: flex; flex-direction: column; height: 100vh; background: var(--bg); }
.cscreen__bar {
  display: flex; align-items: center; gap: 10px; padding: 13px 16px 11px;
  background: var(--surface); border-bottom: 1px solid var(--line); flex-shrink: 0;
}
.cscreen__logo {
  width: 30px; height: 30px; border-radius: 9px; background: var(--accent);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.cscreen__ttl { flex: 1; min-width: 0; }
.cscreen__ttl .t { font-family: Archivo, sans-serif; font-weight: 800; font-size: 16px; color: var(--ink); line-height: 1.1; }
.cscreen__ttl .s { font-family: 'Hanken Grotesk', sans-serif; font-size: 11px; color: var(--mute); }
.cscreen__body { flex: 1; overflow-y: auto; padding: 14px 14px 20px; -webkit-overflow-scrolling: touch; }
.cscreen__body::-webkit-scrollbar { width: 0; }
.cscreen__tabs {
  display: flex; align-items: stretch; border-top: 1px solid var(--line);
  background: var(--surface); flex-shrink: 0; padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
.cscreen__tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 6px 2px; border: none; background: none; cursor: pointer;
  color: var(--mute); font-family: Archivo, sans-serif; font-weight: 700; font-size: 9.5px;
}
.cscreen__tab.is-active { color: var(--accent-text); }
.cscreen__tab .ti {
  width: 26px; height: 26px; border-radius: 9px; display: flex; align-items: center; justify-content: center;
}
.cscreen__tab.is-active .ti { background: var(--accent-wash); }

@keyframes wfade { from { opacity: 0; } to { opacity: 1; } }

/* ════════════════════════ SINGLE PAGE (view=page) ═════════════════════════ */
.cpage { display: flex; flex-direction: column; height: 100vh; background: var(--bg); }
.cpage__head {
  display: flex; align-items: center; gap: 14px; padding: 16px 26px;
  border-bottom: 1px solid var(--line); flex-shrink: 0; background: var(--surface);
}
.cpage__brand { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.cpage__scroll { flex: 1; overflow-y: auto; padding: 24px 26px 36px; background: var(--bg); }
@media (max-width: 600px) {
  .cpage__head { padding: 14px 16px; }
  .cpage__scroll { padding: 16px 16px 30px; }
}

/* ════════════════ COMBINED COMPONENTS (view=combo) ════════════════ */
/* Chrome-less cluster of building blocks; the marketing page sizes the
   frame to this element's height, so keep it tight to its content.
   Wide (desktop) frame → 2-column dashboard; narrow (phone) frame → 1 column. */
.ccombo { padding: 16px; background: var(--bg); box-sizing: border-box; }
body.is-combo { overflow-y: auto; }
body.is-combo #root { height: auto; min-height: 100%; }
.cc-cols { display: flex; flex-direction: column; gap: 14px; }
.cc-col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.cc-kpi { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (min-width: 560px) {
  .ccombo { padding: 24px; }
  .cc-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
  .cc-kpi--3 { grid-template-columns: repeat(3, 1fr); }
  .cc-kpi--4 { grid-template-columns: repeat(4, 1fr); }
}
