/* =====================================================================
   Try Sophia — demo app and floating widget
   ===================================================================== */

.demo-app { display: grid; grid-template-columns: 300px minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
@media (max-width: 1180px) { .demo-app { grid-template-columns: 280px minmax(0, 1fr); } .capture-panel { grid-column: 1 / -1; } }
@media (max-width: 820px) { .demo-app { grid-template-columns: 1fr; } }

.panel { background: var(--white); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 22px; }
.panel h2 { font-size: 1.15rem; margin-bottom: 4px; letter-spacing: -.01em; }
.panel .sub { color: var(--steel); font-size: .9rem; margin: 0 0 18px; }

/* Settings */
.settings { display: grid; gap: 16px; }
.settings label.field { font-size: .88rem; }
.settings .field input, .settings .field select, .settings .field textarea { padding: 10px 12px; font-size: .95rem; }
.settings .field textarea { min-height: 70px; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); border: 1.5px solid var(--line); border-radius: var(--r-sm); overflow: hidden; }
.seg button { border: 0; background: var(--white); font: 500 .9rem var(--font-body); padding: 9px 4px; cursor: pointer; color: var(--steel); }
.seg button + button { border-left: 1.5px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--abyss); color: var(--white); }
.seg-label { font-size: .88rem; font-weight: 500; margin-bottom: 6px; display: block; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: .92rem; cursor: pointer; }
.switch small { display: block; color: var(--steel); font-size: .8rem; }
.switch input { appearance: none; -webkit-appearance: none; flex: none; width: 42px; height: 24px; border-radius: 999px; background: var(--silver); position: relative; cursor: pointer; transition: background-color .2s; margin: 0; }
.switch input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--white); box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s; }
.switch input:checked { background: var(--integra); }
.switch input:checked::after { transform: translateX(18px); }
.settings hr { border: 0; border-top: 1px solid var(--line); margin: 2px 0; width: 100%; }
.demo-hint { font-size: .85rem; background: var(--mist); border-radius: var(--r-sm); padding: 10px 12px; color: var(--steel); }
.demo-hint strong { color: var(--abyss); }

/* Conversation */
.convo { display: flex; flex-direction: column; padding: 0; overflow: hidden; min-height: 640px; }
.convo-top { display: flex; align-items: center; gap: 12px; padding: 16px 20px; background: var(--abyss); color: #c9d3e6; }
.convo-top strong { color: var(--white); font-family: var(--font-display); display: block; line-height: 1.2; }
.convo-top span { font-size: .85rem; }
.mode-pill { margin-left: auto; font-size: .78rem; font-weight: 600; padding: 4px 10px; border-radius: 999px; background: rgba(90,166,255,.16); color: #a8cdff; border: 1px solid rgba(90,166,255,.35); white-space: nowrap; }
.convo .call-timer { margin-left: 8px; }
.log { flex: 1; overflow-y: auto; padding: 22px 20px 12px; display: flex; flex-direction: column; gap: 10px; background: linear-gradient(180deg, #f8fafc, #fff 120px); min-height: 360px; max-height: 520px; }
.msg { max-width: 82%; padding: 11px 15px; border-radius: 16px; line-height: 1.45; font-size: .98rem; animation: msgIn .25s ease; }
@keyframes msgIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.msg--ai { background: var(--mist); border: 1px solid var(--line); color: var(--graphite); border-bottom-left-radius: 4px; }
.msg--caller { background: var(--integra); color: var(--white); margin-left: auto; border-bottom-right-radius: 4px; }
.msg--note { align-self: center; font-size: .82rem; color: var(--steel); background: transparent; padding: 4px 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 6px 20px 12px; }
.chip { font: 500 .9rem var(--font-body); color: var(--integra); background: var(--white); border: 1.5px solid #c5d6f2; border-radius: 999px; padding: 7px 14px; cursor: pointer; transition: background-color .15s, border-color .15s; }
.chip:hover { background: #eef4fe; border-color: var(--integra); }
.composer { display: flex; gap: 8px; padding: 14px 16px; border-top: 1px solid var(--line); background: var(--white); }
.composer input { flex: 1; min-width: 0; font: 400 1rem var(--font-body); border: 1.5px solid var(--line); border-radius: 999px; padding: 11px 18px; }
.composer input:focus { outline: none; border-color: var(--integra); box-shadow: 0 0 0 3px rgba(10,116,224,.18); }
.icon-btn { flex: none; width: 46px; height: 46px; border-radius: 50%; border: 1.5px solid var(--line); background: var(--white); display: grid; place-items: center; cursor: pointer; color: var(--abyss); transition: background-color .15s, border-color .15s; }
.icon-btn:hover { border-color: var(--integra); }
.icon-btn--send { background: var(--integra); border-color: var(--integra); color: var(--white); }
.icon-btn--send:hover { background: var(--signal); }
.icon-btn[disabled] { opacity: .45; cursor: not-allowed; }
.icon-btn.listening { background: #e9f2ff; border-color: var(--signal); color: var(--signal); box-shadow: 0 0 0 0 rgba(10,116,224,.45); animation: micPulse 1.4s ease-out infinite; }
@keyframes micPulse { to { box-shadow: 0 0 0 12px rgba(10,116,224,0); } }
.convo-actions { display: flex; flex-wrap: wrap; gap: 10px; padding: 14px 16px 18px; border-top: 1px solid var(--line); background: var(--mist); align-items: center; }
.convo-actions .muted { font-size: .82rem; margin: 0 0 0 auto; }

/* Captured */
.capture-panel { display: grid; gap: 16px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; font-size: .93rem; }
.kv dt { color: var(--steel); }
.kv dd { margin: 0; color: var(--abyss); font-weight: 500; word-break: break-word; }
.cap-empty { color: var(--steel); font-size: .92rem; margin: 0; }
.cap-action { border-radius: var(--r-md); padding: 14px 16px; border: 1px solid var(--line); background: var(--mist); }
.cap-action strong { display: flex; align-items: center; gap: 8px; color: var(--abyss); font-family: var(--font-display); }
.cap-action p { margin: 6px 0 0; font-size: .88rem; color: var(--steel); }
.cap-action .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--signal); flex: none; }
.cap-action.ok .dot { background: var(--ok); }
.cap-action.warn .dot { background: var(--warn); }
.sentiment { display: inline-flex; align-items: center; gap: 6px; font-size: .85rem; font-weight: 600; padding: 3px 10px; border-radius: 999px; }
.sentiment.pos { background: #e6f6ef; color: var(--ok); }
.sentiment.neu { background: var(--mist); color: var(--steel); }
.sentiment.neg { background: #fdeee9; color: #b42318; }
.email-preview { border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; font-size: .88rem; }
.email-preview header { background: var(--abyss); color: var(--white); padding: 10px 14px; font-family: var(--font-display); font-weight: 600; font-size: .9rem; }
.email-preview .body { padding: 12px 14px; display: grid; gap: 4px; }
.email-preview .body div { display: grid; grid-template-columns: 120px 1fr; gap: 10px; }
.email-preview .body span:first-child { color: var(--steel); }
.email-preview .body span:last-child { word-break: break-word; }
.build-cta { background: var(--abyss); color: #c9d3e6; border-radius: var(--r-lg); padding: 22px; }
.build-cta h3 { color: var(--white); font-size: 1.15rem; }
.build-cta p { font-size: .92rem; }

/* ---------- Floating widget (every page) ---------- */
.sw-launch {
  position: fixed; right: 20px; bottom: 20px; z-index: 150;
  display: flex; align-items: center; gap: 10px;
  background: var(--abyss); color: var(--white); border: 1px solid rgba(255,255,255,.15);
  border-radius: 999px; padding: 8px 18px 8px 8px; cursor: pointer;
  font: 600 .95rem var(--font-display); box-shadow: 0 16px 40px -14px rgba(3,18,61,.6);
}
.sw-launch .avatar { width: 38px; height: 38px; }
.sw-launch:hover { background: var(--abyss-2); }
.sw {
  position: fixed; right: 20px; bottom: 20px; z-index: 160;
  width: min(390px, calc(100vw - 24px)); height: min(620px, calc(100vh - 40px));
  background: var(--white); border-radius: var(--r-lg); overflow: hidden;
  box-shadow: 0 30px 80px -20px rgba(3,18,61,.55); border: 1px solid var(--line);
  display: none; flex-direction: column;
}
.sw.open { display: flex; animation: swIn .2s ease; }
@keyframes swIn { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
.sw .convo-top { padding: 12px 14px; }
.sw .convo-top .avatar { width: 36px; height: 36px; }
.sw-close { margin-left: auto; background: none; border: 0; color: #c9d3e6; font-size: 1.5rem; line-height: 1; cursor: pointer; padding: 4px 6px; }
.sw-scen { display: flex; gap: 6px; padding: 10px 12px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.sw-scen button { flex: none; font: 500 .82rem var(--font-body); border: 1px solid var(--line); background: var(--white); border-radius: 999px; padding: 6px 12px; cursor: pointer; color: var(--steel); }
.sw-scen button[aria-pressed="true"] { background: var(--abyss); border-color: var(--abyss); color: var(--white); }
.sw .log { max-height: none; min-height: 0; padding: 14px; }
.sw .msg { font-size: .93rem; }
.sw .chips { padding: 4px 12px 8px; max-height: 120px; overflow-y: auto; }
.sw .chip { font-size: .84rem; padding: 6px 12px; }
.sw .composer { padding: 10px 12px; }
.sw .composer input { padding: 9px 14px; font-size: .95rem; }
.sw .icon-btn { width: 40px; height: 40px; }
.sw-foot { display: flex; justify-content: space-between; gap: 8px; padding: 8px 14px 12px; font-size: .82rem; background: var(--mist); }
.sw-foot a { text-decoration: none; font-weight: 600; }
@media (max-width: 520px) {
  .sw { right: 12px; bottom: 12px; }
  .sw-launch { right: 12px; bottom: 12px; }
  .sw-launch .label { display: none; }
  .sw-launch { padding: 8px; }
}

/* ---- fixes after visual review ---- */
.convo-top > div:not(.avatar):not(.call-timer) { flex: 1; min-width: 0; }
.convo-top > div:not(.call-timer) span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.convo .mode-pill { margin-left: 0; }
@media (max-width: 560px) { .convo .mode-pill { display: none; } }
