:root {
  --red: #e41f46;
  --red-d: #c4163a;
  --ink: #1d1d1b;
  --muted: #5f5f68;
  --line: #e6e6ec;
  --bg: #f4f4f7;
  --card: #ffffff;
  --soft: #f6f6f9;
  --sidebar: #17171b;
  --sidebar-2: #202026;
  --green: #0a7d4f;
  --amber: #9a6700;
  --blue: #1257a8;
}
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
}
body {
  font-family:
    "Space Grotesk",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Arial,
    sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
}
code {
  background: #ececf2;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 0.85em;
  font-family: "SFMono-Regular", Menlo, monospace;
}

/* Striscia case study (fuori dal frame LMS) */
.casebar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #0f0f12;
  color: #cfcfd6;
  padding: 7px 18px;
  font-size: 12.5px;
}
.casebar-label {
  letter-spacing: 0.3px;
}
.casebar-nav {
  display: flex;
  gap: 6px;
}
.casebar-nav a {
  color: #cfcfd6;
  text-decoration: none;
  padding: 4px 11px;
  border-radius: 999px;
  border: 1px solid #2c2c33;
}
.casebar-nav a.active {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
}
.casebar-nav a:hover {
  border-color: var(--red);
}

/* Layout LMS */
.lms {
  display: grid;
  grid-template-columns: 248px 1fr;
  min-height: calc(100vh - 35px);
}

/* Sidebar */
.sidebar {
  background: var(--sidebar);
  color: #e7e7ee;
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
  position: sticky;
  top: 0;
  height: calc(100vh - 35px);
}
.brandbox {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 4px 8px 18px;
}
.brandbox .logo {
  height: 26px;
  width: auto;
}
.brandbox .product {
  font-size: 12px;
  color: #9a9aa6;
  border-left: 1px solid #33333c;
  padding-left: 9px;
  font-weight: 500;
}
.side-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}
.sn {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 11px;
  border-radius: 9px;
  color: #c9c9d2;
  text-decoration: none;
  font-size: 13.5px;
  cursor: pointer;
  border-left: 3px solid transparent;
}
.sn .ic {
  width: 18px;
  text-align: center;
  opacity: 0.85;
  font-size: 14px;
}
.sn:hover {
  background: var(--sidebar-2);
  color: #fff;
}
.sn.active {
  background: linear-gradient(90deg, rgba(228, 31, 70, 0.18), transparent);
  color: #fff;
  border-left-color: var(--red);
}
.sn.ai {
  color: #f1c0cb;
}
.sn.ai .ic {
  color: var(--red);
  opacity: 1;
}
.sn.dim {
  color: #7d7d88;
}
.sn-sep {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: #66666f;
  padding: 14px 11px 5px;
}
.side-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  border-top: 1px solid #2a2a31;
  padding-top: 13px;
  margin-top: 8px;
}
.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--red);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
}
.side-foot .who {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}
.side-foot .who b {
  font-size: 13px;
}
.side-foot .who span {
  font-size: 11px;
  color: #8a8a94;
}

/* Main */
.lms-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.lms-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #fff;
  border-bottom: 1px solid var(--line);
  padding: 13px 24px;
  position: sticky;
  top: 0;
  z-index: 5;
  flex-wrap: wrap;
  gap: 8px;
}
.crumbs {
  font-size: 13px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 7px;
}
.crumbs i {
  color: #c2c2cc;
  font-style: normal;
}
.crumbs b {
  color: var(--ink);
}
.top-right {
  display: flex;
  gap: 8px;
  align-items: center;
}
.ai-pill,
.mode-pill {
  font-size: 11.5px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--soft);
  color: var(--muted);
}
.ai-pill {
  border-color: #f5c9d2;
  background: #fdeef1;
  color: var(--red);
  font-weight: 600;
}
.mode-pill {
  font-weight: 600;
}
.mode-fallback {
  background: #fff6e6;
  border-color: #f0d79a;
  color: var(--amber);
}
.mode-live {
  background: #e7f6ee;
  border-color: #a9dcc2;
  color: var(--green);
}

/* Course area */
.course {
  display: grid;
  grid-template-columns: 1fr 384px;
  gap: 20px;
  padding: 22px 24px 40px;
  align-items: start;
}
@media (max-width: 1080px) {
  .course {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 720px) {
  .lms {
    grid-template-columns: 1fr;
  }
  .sidebar {
    display: none;
  }
}

.activity {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}
.course-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}
.ch-path {
  font-size: 12px;
  color: var(--red);
  font-weight: 600;
  letter-spacing: 0.2px;
}
.course-head h1 {
  font-size: 25px;
  margin: 5px 0 9px;
  letter-spacing: -0.4px;
  line-height: 1.1;
}
.ch-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.chip-prop,
.chip-due {
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #fff;
}
.chip-prop {
  color: var(--muted);
}
.chip-due {
  color: var(--amber);
  background: #fff6e6;
  border-color: #f0d79a;
}
.ch-prog {
  position: relative;
  width: 56px;
  height: 56px;
  flex-shrink: 0;
}
.ring {
  width: 56px;
  height: 56px;
  transform: rotate(-90deg);
}
.ring-bg {
  fill: none;
  stroke: #eaeaef;
  stroke-width: 3;
}
.ring-fill {
  fill: none;
  stroke: var(--red);
  stroke-width: 3;
  stroke-linecap: round;
}
.ring-num {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12.5px;
  font-weight: 700;
}

.video {
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
}
.video-frame {
  position: relative;
  background: #14141a;
  height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
/* Overlay scuro in basso per la leggibilita' di titolo e barra, sopra al video */
.video-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(15, 15, 20, 0.05) 40%,
    rgba(15, 15, 20, 0.6) 100%
  );
  z-index: 1;
  pointer-events: none;
}
.video-media {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
}
.video-frame .play {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  backdrop-filter: blur(2px);
  border: none;
  cursor: pointer;
  z-index: 2;
}
.video-frame .play:hover {
  background: rgba(255, 255, 255, 0.28);
}
.video-frame.playing .play {
  opacity: 0;
  pointer-events: none;
}

/* Hotspot interattivi sul fotogramma (sopra al play, sempre cliccabili) */
.hotspots {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
}
.hotspots .hotspot {
  pointer-events: auto;
}
.hotspot {
  position: absolute;
  width: 26px;
  height: 26px;
  transform: translate(-50%, -50%);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}
.hs-dot {
  display: block;
  width: 14px;
  height: 14px;
  margin: 6px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 0 4px rgba(228, 31, 70, 0.28);
  animation: hsPulse 2.2s ease-out infinite;
}
.hotspot:hover .hs-dot,
.hotspot.on .hs-dot {
  background: #fff;
  box-shadow: 0 0 0 4px rgba(228, 31, 70, 0.85);
}
@keyframes hsPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(228, 31, 70, 0.5);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(228, 31, 70, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(228, 31, 70, 0);
  }
}
.hs-pop {
  position: absolute;
  z-index: 6;
  left: 16px;
  right: 16px;
  top: 16px;
  background: rgba(20, 20, 26, 0.93);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  padding: 11px 13px;
  backdrop-filter: blur(3px);
}
.hs-pop.hidden {
  display: none;
}
.hs-pop-title {
  font-weight: 700;
  font-size: 13.5px;
}
.hs-pop-text {
  font-size: 12.5px;
  opacity: 0.92;
  margin-top: 3px;
  line-height: 1.45;
}
.hs-pop-cite {
  margin-top: 7px;
  font-size: 11px;
  color: #f1c0cb;
  font-weight: 600;
}
.vhint {
  position: absolute;
  right: 14px;
  bottom: 22px;
  font-size: 11px;
  color: #fff;
  opacity: 0.8;
  background: rgba(0, 0, 0, 0.32);
  padding: 3px 8px;
  border-radius: 6px;
  z-index: 2;
}
.vmeta {
  position: absolute;
  left: 16px;
  bottom: 22px;
  color: #fff;
  z-index: 2;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}
.vtitle {
  font-size: 14px;
  font-weight: 600;
}
.vtime {
  font-size: 12px;
  opacity: 0.82;
}
.vbar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 5px;
  background: rgba(255, 255, 255, 0.18);
  z-index: 2;
}
.vbar-fill {
  width: 37%;
  height: 100%;
  background: var(--red);
}

/* Lettura dell'attivita': pill sotto il video, niente overlay sul fotogramma */
.frame-read {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
}
.fr-head {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 9px;
}
.fr-sub {
  font-weight: 400;
  color: var(--muted);
  font-size: 11.5px;
  margin-left: 4px;
}
.fr-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.fr-pill {
  font-size: 12.5px;
  font-family: inherit;
  font-weight: 600;
  color: #353539;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 12px;
  cursor: pointer;
}
.fr-pill:hover {
  border-color: var(--red);
  color: var(--red);
}
.fr-pill.on {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}
.fr-info {
  margin-top: 10px;
  border-left: 3px solid var(--red);
  background: var(--soft);
  border-radius: 0 8px 8px 0;
  padding: 9px 12px;
}
.fr-info.hidden {
  display: none;
}
.fr-info-title {
  font-weight: 700;
  font-size: 13px;
}
.fr-info-text {
  font-size: 12.5px;
  color: #353539;
  margin-top: 3px;
  line-height: 1.45;
}
.fr-info-cite {
  margin-top: 6px;
  font-size: 11.5px;
  color: var(--blue);
  font-weight: 600;
}

.act-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line);
}
.tab {
  font-size: 13px;
  padding: 8px 13px;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tab.active {
  color: var(--ink);
  border-bottom-color: var(--red);
  font-weight: 600;
}

.stall-btn {
  width: 100%;
  background: #fff;
  border: 1.5px dashed var(--red);
  color: var(--red);
  font-weight: 600;
  font-family: inherit;
  padding: 11px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 13.5px;
}
.stall-btn:hover {
  background: #fdf2f4;
}
.stall-btn:disabled {
  opacity: 0.5;
  cursor: default;
  border-style: solid;
}

/* Podcast del modulo (generato dal Companion) */
.podcast {
  display: flex;
  gap: 13px;
  background: linear-gradient(120deg, #fdeef1, #fff 60%);
  border: 1px solid #f3c9d2;
  border-radius: 12px;
  padding: 14px 16px;
}
.pod-ic {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--red);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}
.pod-body {
  flex: 1;
  min-width: 0;
}
.pod-head {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}
.pod-title {
  font-weight: 700;
  font-size: 14px;
}
.pod-tag {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--red);
  background: #fff;
  border: 1px solid #f3c9d2;
  border-radius: 5px;
  padding: 1px 7px;
}
.pod-sub {
  font-size: 12.5px;
  color: #4a4a52;
  margin: 5px 0 9px;
  line-height: 1.45;
}
.pod-audio {
  width: 100%;
  height: 36px;
}

.legend {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
}
.legend-title {
  font-weight: 700;
  font-size: 13.5px;
  margin-bottom: 6px;
}
.legend ul {
  margin: 0;
  padding-left: 18px;
}
.legend li {
  font-size: 13px;
  margin: 4px 0;
  color: #353539;
}

/* Companion */
.companion {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  min-height: 560px;
  position: sticky;
  top: 86px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(20, 20, 30, 0.04);
}
.comp-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(90deg, #fdeef1, #fff);
}
.comp-id {
  font-weight: 700;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.comp-id .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--green);
  display: inline-block;
}

.badge {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  padding: 4px 11px;
  border-radius: 999px;
  border: 1px solid transparent;
}
.badge-idle {
  background: #eee;
  color: var(--muted);
}
.badge-answer {
  background: #e7f6ee;
  color: var(--green);
  border-color: #a9dcc2;
}
.badge-refusal {
  background: #fff6e6;
  color: var(--amber);
  border-color: #f0d79a;
}
.badge-escalation {
  background: #fdeaea;
  color: var(--red);
  border-color: #f3b6bf;
}

.stream {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 460px;
}
.msg {
  display: flex;
}
.msg.user {
  justify-content: flex-end;
}
.bubble {
  max-width: 88%;
  padding: 10px 13px;
  border-radius: 13px;
  font-size: 14px;
  line-height: 1.5;
}
.msg.coach .bubble {
  background: var(--soft);
  border: 1px solid var(--line);
}
.msg.user .bubble {
  background: var(--red);
  color: #fff;
}
.msg.coach.escalation .bubble {
  background: #fdeaea;
  border-color: #f3b6bf;
}
.msg.coach.refusal .bubble {
  background: #fff6e6;
  border-color: #f0d79a;
}

.cites {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.cite {
  font-size: 11.5px;
  background: #eef3fb;
  color: var(--blue);
  border: 1px solid #cfe0f5;
  padding: 2px 8px;
  border-radius: 6px;
  font-weight: 600;
}
.meta-line {
  margin-top: 7px;
  font-size: 11.5px;
  color: var(--muted);
}
.meta-line b {
  color: var(--ink);
}

.scenario {
  border-top: 1px solid var(--line);
  padding: 14px 16px;
  background: #fffdfa;
}
.scenario.hidden {
  display: none;
}
.scn-q {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 10px;
}
.scn-q .scn-tag {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--red);
  background: #fdeef1;
  border-radius: 5px;
  padding: 1px 7px;
  margin-right: 7px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.scn-opts {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.scn-opt {
  text-align: left;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
  font-size: 13.5px;
  font-family: inherit;
}
.scn-opt:hover {
  border-color: var(--red);
  background: #fdf2f4;
}
.scn-opt:disabled {
  opacity: 0.55;
  cursor: default;
}

.composer {
  border-top: 1px solid var(--line);
  padding: 12px 14px;
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}
.chip {
  font-size: 12px;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 11px;
  cursor: pointer;
  color: #353539;
  font-family: inherit;
}
.chip:hover {
  border-color: var(--red);
  color: var(--red);
}
/* Modalita' vocale */
.voicebar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 9px;
}
.vtoggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-family: inherit;
  font-weight: 600;
  color: var(--muted);
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 11px;
  cursor: pointer;
}
.vtoggle .vt-ic {
  color: var(--muted);
}
.vtoggle[aria-pressed="true"] {
  color: var(--red);
  border-color: #f3c9d2;
  background: #fdeef1;
}
.vtoggle[aria-pressed="true"] .vt-ic {
  color: var(--red);
}
.voicehint {
  font-size: 11.5px;
  color: #9a9aa6;
}
.mic-btn {
  flex-shrink: 0;
  width: 42px;
  border: 1px solid var(--line);
  background: var(--soft);
  border-radius: 10px;
  cursor: pointer;
  font-size: 17px;
  font-family: inherit;
}
.mic-btn:hover {
  border-color: var(--red);
}
.mic-btn.listening {
  background: var(--red);
  border-color: var(--red);
  animation: micPulse 1.1s ease-out infinite;
}
@keyframes micPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(228, 31, 70, 0.45);
  }
  70% {
    box-shadow: 0 0 0 9px rgba(228, 31, 70, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(228, 31, 70, 0);
  }
}
.companion.speaking .comp-id .dot {
  animation: micPulse 1.1s ease-out infinite;
}
.voice-unsupported .voicebar,
.voice-unsupported .mic-btn {
  display: none;
}

.input-row {
  display: flex;
  gap: 8px;
}
.input-row input {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  outline: none;
  font-family: inherit;
}
.input-row input:focus {
  border-color: var(--red);
}
.input-row button {
  background: var(--red);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 0 18px;
  font-weight: 700;
  cursor: pointer;
  font-size: 14px;
  font-family: inherit;
}
.input-row button:hover {
  background: var(--red-d);
}
.input-row button:disabled {
  opacity: 0.6;
  cursor: default;
}
/* Indicatore di lavoro sobrio (sostituisce la typing animation) */
.thinking {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 12px 13px;
}
.thinking span:not(.think-cap) {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted);
  opacity: 0.4;
  animation: thinkDot 1s ease-in-out infinite;
}
.thinking .think-cap {
  margin-left: 4px;
  font-size: 12px;
  color: var(--muted);
}
.thinking span:nth-child(2) {
  animation-delay: 0.16s;
}
.thinking span:nth-child(3) {
  animation-delay: 0.32s;
}
@keyframes thinkDot {
  0%,
  60%,
  100% {
    opacity: 0.25;
    transform: translateY(0);
  }
  30% {
    opacity: 0.9;
    transform: translateY(-3px);
  }
}

/* Progress della pratica guidata a step */
.scn-prog {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 10px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--muted);
}
.scn-steps {
  display: flex;
  gap: 4px;
}
.scn-steps i {
  width: 22px;
  height: 4px;
  border-radius: 2px;
  background: var(--line);
  display: inline-block;
}
.scn-steps i.done {
  background: var(--green);
}
.scn-steps i.cur {
  background: var(--red);
}
.scn-done {
  background: #e7f6ee;
  border: 1px solid #a9dcc2;
  border-radius: 10px;
  padding: 12px 14px;
  margin-top: 4px;
}
.scn-done b {
  color: var(--green);
}
.scn-done .xapi {
  margin-top: 6px;
  font-size: 11.5px;
  color: var(--muted);
  font-family: "SFMono-Regular", Menlo, monospace;
}
