/* ── Reset ────────────────────────────────────────────────────────────────── */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ── Base ─────────────────────────────────────────────────────────────────── */

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--background);
  min-height: 100vh;
  color: var(--foreground);
  line-height: 1.6;
}

/* ── Custom Icon System ───────────────────────────────────────────────────── */

.icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1em;
  height: 1em;
  flex-shrink: 0;
}

.icon svg {
  width: 100%;
  height: 100%;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ── Sidebar ──────────────────────────────────────────────────────────────── */

:root {
  --sb-width: 240px;
  --sb-bg: #ffffff;
  --sb-border: #E5E5E5;
  --sb-accent: #D15000;

  /* Design System Variables */
  --primary: #D15000;
  --primary-foreground: #FFFFFF;
  --secondary: #CCCCCC;
  --accent: #EBEBEB;
  --background: #F5F5F5;
  --card: #FFFFFF;
  --muted-surface: #E5E5E5;
  --popover: #FFFFFF;
  --foreground: #030712;
  --muted-foreground: #6B7280;
  --destructive: #EF4444;

  /* Shapes */
  --radius-lg: 8px;
  --radius-xl: 12px;
  --radius-2xl: 16px;
  --radius-3xl: 24px;
}

body {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sb-width);
  min-height: 100vh;
  background: var(--sb-bg);
  border-right: 1.5px solid var(--sb-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 200;
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.05);
  overflow-y: auto;
  overflow-x: hidden;
  transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1), transform 0.25s ease;
  font-family: 'Inter', sans-serif;
}

/* Brand */
.sb-brand-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1.5px solid var(--sb-border);
  padding-right: 12px;
  transition: padding 0.25s ease;
}

.sb-brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: 20px 16px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s, padding 0.25s ease;
  flex: 1;
}

.sb-brand:hover {
  background: #fafafa;
}

.sb-logo {
  max-height: 48px;
  max-width: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  flex-shrink: 0;
}

.sb-brand-text {
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  line-height: 1.2;
  color: #282828;
  font-weight: 600;
  letter-spacing: -0.5px;
  white-space: nowrap;
}

.sb-close-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  color: #888;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.sb-close-btn:hover {
  background: var(--accent);
  color: var(--sb-accent);
}

.sb-brand-text strong {
  color: #1a1a1a;
  font-size: 15px;
  font-weight: 800;
}

/* Section labels */
.sb-section-label {
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #bbb;
  padding: 12px 20px 4px;
  font-family: 'Inter', sans-serif;
}

/* Nav links */
.sb-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 4px 12px 0;
}

.sb-link {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  color: #666;
  text-decoration: none;
  transition: all 0.15s;
  margin-bottom: 2px;
  white-space: nowrap;
}

.sb-link svg {
  flex-shrink: 0;
  color: #aaa;
  transition: color 0.15s;
}

.sb-link:hover {
  background: var(--accent);
  color: var(--sb-accent);
}

.sb-link:hover svg {
  color: var(--sb-accent);
}

.sb-link.active {
  background: var(--primary);
  color: white;
  box-shadow: 0 4px 14px rgba(209, 80, 0, 0.25);
}

.sb-link.active svg {
  color: white;
}

.sb-divider {
  height: 1px;
  background: var(--sb-border);
  margin: 10px 4px;
}

/* User footer */
.sb-footer {
  padding: 14px 16px;
  border-top: 1.5px solid var(--sb-border);
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.sb-user {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.sb-user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #e45700, #ff7b2e);
  color: white;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sb-user-info {
  min-width: 0;
}

.sb-user-name {
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: #1a1a1a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sb-user-role {
  font-family: 'Inter', sans-serif;
  font-size: 10px;
  font-weight: 600;
  color: #aaa;
  white-space: nowrap;
}

.sb-role-super {
  color: var(--sb-accent);
}

.sb-role-company {
  color: #7c3aed;
}

.sb-logout {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  color: #bbb;
  text-decoration: none;
  flex-shrink: 0;
  transition: all 0.2s;
}

.sb-logout:hover {
  background: #fff0f0;
  color: #e53e3e;
}

/* ── Main content wrapper ─────────────────────────────────────────────────── */
.app-body {
  flex: 1;
  min-width: 0;
  min-height: 100vh;
  background: #ffffff;
}

.app-body.has-sidebar {
  margin-left: var(--sb-width);
  transition: margin-left 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Mobile topbar (hidden on desktop) ────────────────────────────────────── */
.mobile-topbar {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 54px;
  background: white;
  border-bottom: 1.5px solid #f0f0f0;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.07);
  z-index: 190;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
}

.sb-brand-text-mobile {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 16px;
  font-weight: 800;
  color: #1a1a1a;
}

.sb-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  color: #444;
  border-radius: 8px;
  display: flex;
  align-items: center;
  transition: background 0.2s;
}

.sb-toggle:hover {
  background: #f5f5f5;
}

.sb-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 199;
  opacity: 0;
  transition: opacity 0.25s;
}

.sb-overlay.visible {
  opacity: 1;
}

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sb-overlay {
    display: block;
    pointer-events: none;
  }

  .sb-overlay.visible {
    pointer-events: auto;
  }

  .mobile-topbar {
    display: flex;
  }

  .app-body.has-sidebar {
    margin-left: 0;
    padding-top: 54px;
  }
}

/* Keep legacy .navbar rules from breaking anything on login page */
.navbar {
  display: none;
}

/* ── Sidebar Collapsed States ────────────────────────────────────────────── */
html.sidebar-collapsed .sidebar {
  width: 70px;
}

html.sidebar-collapsed .app-body.has-sidebar {
  margin-left: 70px;
}

.sidebar.collapsed .sb-brand-text {
  display: none;
}

.sidebar.collapsed .sb-close-btn {
  display: none;
}

.sidebar.collapsed .sb-brand-wrapper {
  padding-right: 0;
}

.sidebar.collapsed .sb-brand {
  align-items: center;
  justify-content: center;
  padding: 16px 0;
}

.sidebar.collapsed .sb-logo {
  max-width: 44px;
  height: auto;
  max-height: 34px;
  object-fit: contain;
}

.sidebar.collapsed .sb-nav {
  padding-top: 16px;
}

.sidebar.collapsed .sb-section-label {
  display: none;
}

.sidebar.collapsed .sb-link span {
  display: none;
}

.sidebar.collapsed .sb-link {
  justify-content: center;
  padding: 10px 0;
}

.sidebar.collapsed .sb-divider {
  margin: 10px 12px;
}

.sidebar.collapsed .sb-user-info {
  display: none;
}

.sidebar.collapsed .sb-logout {
  display: none;
}

.sidebar.collapsed .sb-user {
  flex: none;
  margin: 0 auto;
}

.sidebar.collapsed .sb-footer {
  justify-content: center;
  padding: 14px 0;
}

/* Override collapsed states on mobile so the drawer opens full width */
@media (max-width: 768px) {
  html.sidebar-collapsed .sidebar {
    width: var(--sb-width) !important;
  }
  html.sidebar-collapsed .app-body.has-sidebar {
    margin-left: 0 !important;
  }
  .sidebar.collapsed .sb-brand-text {
    display: inline !important;
  }
  .sidebar.collapsed .sb-close-btn {
    display: flex !important;
  }
  .sidebar.collapsed .sb-brand-wrapper {
    padding-right: 12px !important;
  }
  .sidebar.collapsed .sb-brand {
    justify-content: flex-start !important;
    padding: 22px 20px 18px !important;
  }
  .sidebar.collapsed .sb-section-label {
    display: block !important;
  }
  .sidebar.collapsed .sb-link span {
    display: inline !important;
  }
  .sidebar.collapsed .sb-link {
    justify-content: flex-start !important;
    padding: 10px 12px !important;
  }
  .sidebar.collapsed .sb-user-info {
    display: block !important;
  }
  .sidebar.collapsed .sb-logout {
    display: flex !important;
  }
  .sidebar.collapsed .sb-footer {
    justify-content: flex-start !important;
    padding: 14px 16px !important;
  }
}

/* ── Page ─────────────────────────────────────────────────────────────────── */

.page {
  padding: 36px 32px;
  max-width: 1200px;
  margin: 0 auto;
}

h1 {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--foreground);
  margin-bottom: 12px;
}

h2 {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 24px;
  font-weight: 700;
  color: var(--foreground);
  margin-bottom: 20px;
}

h3 {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 18px;
  font-weight: 600;
  color: var(--foreground);
  margin-bottom: 10px;
}

p {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.7;
  color: var(--foreground);
}

/* ── Buttons ──────────────────────────────────────────────────────────────── */

.primary {
  background: var(--primary);
  color: var(--primary-foreground);
  padding: 14px 28px;
  border: none;
  border-radius: var(--radius-xl);
  margin: 10px;
  cursor: pointer;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 15px;
  font-weight: 700;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 15px rgba(209, 80, 0, 0.3);
  border: 2px solid transparent;
  position: relative;
  overflow: hidden;
}

.primary::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s;
}

.primary:hover::before {
  left: 100%;
}

.primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(209, 80, 0, 0.4);
}

.primary:active:not(:disabled) {
  transform: translateY(0);
}

.primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.secondary {
  background: transparent;
  border: 1px solid var(--muted-surface);
  color: var(--foreground);
  padding: 14px 28px;
  border-radius: var(--radius-xl);
  margin: 10px;
  cursor: pointer;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 15px;
  font-weight: 600;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.secondary:hover:not(:disabled) {
  background: var(--accent);
  border-color: var(--muted-surface);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.secondary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.danger {
  background: var(--destructive);
  color: white;
  padding: 10px 18px;
  border: none;
  border-radius: var(--radius-lg);
  cursor: pointer;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 14px;
  font-weight: 700;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.danger:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(239, 68, 68, 0.4);
}

.danger:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ── Cards ────────────────────────────────────────────────────────────────── */

.card {
  background: var(--card);
  padding: 28px;
  margin: 20px 0;
  border-radius: var(--radius-xl);
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  border: 1px solid var(--muted-surface);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.card:hover {
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  transform: translateY(-4px);
  border-color: rgba(209, 80, 0, 0.2);
}

/* ── Home / Center ────────────────────────────────────────────────────────── */

.center {
  text-align: center;
  margin-top: 120px;
  max-width: 680px;
  margin-left: auto;
  margin-right: auto;
}

.center h1 {
  margin-bottom: 16px;
  background: linear-gradient(135deg, #e45700, #ff7b2e);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.center p {
  color: #666;
  font-size: 16px;
  margin: 0 auto 40px;
  max-width: 520px;
  line-height: 1.8;
  font-family: 'Plus Jakarta Sans', sans-serif;
}

.center .subtitle {
  font-size: 18px;
  color: #888;
  font-weight: 500;
  margin-bottom: 40px;
}

/* ── Form card (new session) ──────────────────────────────────────────────── */

.form-card {
  background: white;
  padding: 32px;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  max-width: 540px;
  margin: 0 auto;
}

.form-card label {
  display: block;
  font-size: 13px;
  font-weight: bold;
  color: #444;
  margin-top: 20px;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.form-card label:first-of-type {
  margin-top: 0;
}

.form-card select,
.form-card textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 14px;
  color: #222;
  background: #fafafa;
  transition: border-color 0.15s;
  appearance: none;
}

.form-card select:focus,
.form-card textarea:focus {
  outline: none;
  border-color: #e45700;
}

.form-card textarea {
  resize: vertical;
  min-height: 80px;
  display: none;
  margin-top: 8px;
}

.form-card button {
  width: 100%;
  margin-top: 28px;
  padding: 14px;
  font-size: 15px;
  margin-left: 0;
  margin-right: 0;
}

/* ── Session page ─────────────────────────────────────────────────────────── */

/* Full-height layout for chat page */
.session-page .app-body {
  height: 100vh;
  overflow: hidden;
}

.session-page .page {
  max-width: 100%;
  padding: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

@media (max-width: 768px) {
  .session-page .page {
    height: calc(100vh - 54px);
  }
}

/* ── Main area: wraps chatbox + voiceInput ── */
.main-area {
  flex: 1;
  display: flex;
  flex-direction: row;
  overflow: hidden;
  position: relative;
}

/* Transcript column wraps the header + chatbox */
.transcript-column {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
  min-width: 0;
}

/* Win conditions sidebar: always on the right */
.wc-sidebar {
  order: 10;
}

/* Voice mode: side-by-side layout */
.main-area.voice-mode {
  flex-direction: row;
}

/* Voice panel LEFT (1), resizer MIDDLE (2), transcript RIGHT (3) */
.main-area.voice-mode #voiceInput {
  order: 1;
  flex: 1 1 0;
  min-width: 280px;
  max-width: none;
}

/* Resizer sits between the two panels */
.main-area.voice-mode #voiceResizer {
  order: 2;
}

/* Transcript column becomes the right panel — default 50% */
.main-area.voice-mode .transcript-column {
  order: 3;
  flex: 1 1 0;
  width: auto;
  min-width: 220px;
  max-width: none;
  border-left: none;
  background: #f9f9f9;
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.06);
}

/* Sidebar resizer between chat and goals */
.wc-resizer {
  flex: 0 0 16px;
  width: 16px;
  cursor: col-resize;
  position: relative;
  z-index: 10;
  background: #f0f0f0;
  border-left: 1px solid #e8e8e8;
  border-right: 1px solid #e8e8e8;
  transition: background 0.2s;
  align-self: stretch;
  display: none;
  align-items: center;
  justify-content: center;
}

.wc-resizer:hover,
.wc-resizer.dragging {
  background: #fff3eb;
  border-left-color: #e45700;
  border-right-color: #e45700;
}

.wc-resizer-bar {
  width: 4px;
  height: 32px;
  background: repeating-linear-gradient(to bottom,
      #ccc 0px, #ccc 4px,
      transparent 4px, transparent 8px);
  border-radius: 2px;
  transition: background 0.2s, height 0.2s;
}

.wc-resizer:hover .wc-resizer-bar,
.wc-resizer.dragging .wc-resizer-bar {
  background: repeating-linear-gradient(to bottom,
      #e45700 0px, #e45700 4px,
      transparent 4px, transparent 8px);
  height: 48px;
}

.main-area.voice-mode .wc-resizer {
  order: 4;
  display: flex;
}

.main-area.voice-mode .wc-sidebar {
  order: 5;
}

/* In voice mode the chatbox fills the transcript column */
.main-area.voice-mode #chatbox {
  padding: 16px 18px;
  gap: 10px;
}

/* Transcript panel header bar */
.transcript-panel-header {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 11px 18px;
  background: white;
  border-bottom: 1px solid #ebebeb;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: #bbb;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

/* In voice mode, messages in transcript are smaller and tighter */
.main-area.voice-mode .message {
  max-width: 92%;
}

.main-area.voice-mode .bubble {
  font-size: 13px;
  padding: 9px 14px;
}

.main-area.voice-mode .message-label {
  font-size: 10px;
}

/* Responsive: stack on small screens */
@media (max-width: 860px) {
  .main-area.voice-mode {
    flex-direction: column;
  }

  .main-area.voice-mode #voiceInput {
    order: 1;
    flex: 1;
  }

  .main-area.voice-mode .transcript-column {
    order: 2;
    flex: 0 0 200px;
    max-width: 100%;
    border-left: none;
    border-top: 1px solid #ebebeb;
    box-shadow: none;
  }

  /* Hide resizer on mobile */
  .voice-resizer,
  .wc-resizer {
    display: none !important;
  }
}

/* ── Voice panel resizer handle ── */
.voice-resizer {
  flex: 0 0 16px;
  width: 16px;
  cursor: col-resize;
  position: relative;
  z-index: 10;
  background: #f0f0f0;
  border-left: 1px solid #e8e8e8;
  border-right: 1px solid #e8e8e8;
  transition: background 0.2s;
  align-self: stretch;
  display: none;
  /* default hidden; shown in voice mode via CSS order override above */
  align-items: center;
  justify-content: center;
}

.voice-resizer:hover,
.voice-resizer.dragging {
  background: #fff3eb;
  border-left-color: #e45700;
  border-right-color: #e45700;
}

/* Three-dot grip indicator */
.voice-resizer-bar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

/* Replace bar with dots pattern */
.voice-resizer-bar {
  width: 4px;
  height: 32px;
  background: repeating-linear-gradient(to bottom,
      #ccc 0px, #ccc 4px,
      transparent 4px, transparent 8px);
  border-radius: 2px;
  transition: background 0.2s, height 0.2s;
}

.voice-resizer:hover .voice-resizer-bar,
.voice-resizer.dragging .voice-resizer-bar {
  background: repeating-linear-gradient(to bottom,
      #e45700 0px, #e45700 4px,
      transparent 4px, transparent 8px);
  height: 48px;
}

.session-header {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  padding: 16px 40px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  display: flex;
  align-items: center;
  gap: 24px;
  flex-shrink: 0;
  flex-wrap: wrap;
  border-bottom: 1px solid rgba(255, 255, 255, 0.5);
}

.session-meta {
  display: flex;
  gap: 16px;
  flex: 1;
  flex-wrap: wrap;
}

.session-tag {
  font-size: 13px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  color: #555;
  background: white;
  border: 1.5px solid #e8e8e8;
  border-radius: 20px;
  padding: 6px 16px;
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.session-tag strong {
  color: #e45700;
  font-weight: 700;
}

/* Chatbox */
.chatbox {
  flex: 1;
  background: #fafafa;
  padding: 24px;
  overflow-y: auto;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chatbox::-webkit-scrollbar {
  width: 6px;
}

.chatbox::-webkit-scrollbar-track {
  background: #f0f0f0;
}

.chatbox::-webkit-scrollbar-thumb {
  background: #ddd;
  border-radius: 3px;
}

.chatbox::-webkit-scrollbar-thumb:hover {
  background: #ccc;
}

/* Messages */
.message {
  display: flex;
  flex-direction: column;
  max-width: 65%;
  margin: 6px 0;
  animation: messageSlideIn 0.3s ease;
}

@keyframes messageSlideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message.user {
  align-self: flex-end;
  align-items: flex-end;
}

.message.ai {
  align-self: flex-start;
  align-items: flex-start;
}

.message-label {
  font-size: 10px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #aaa;
  margin-bottom: 5px;
  padding: 0 6px;
}

.bubble {
  padding: 12px 18px;
  border-radius: 12px;
  font-size: 14px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  line-height: 1.6;
  word-break: break-word;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.message.user .bubble {
  background: linear-gradient(135deg, #e45700, #ff7b2e);
  color: white;
  border-radius: 12px 12px 4px 12px;
}

.message.ai .bubble {
  background: white;
  color: #333;
  border: 1px solid #e8e8e8;
  border-radius: 12px 12px 12px 4px;
}

/* Typing dots */
.typing-indicator .bubble {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 14px 20px;
}

.dot {
  width: 8px;
  height: 8px;
  background: #bbb;
  border-radius: 50%;
  animation: bounce 1.2s infinite;
}

.dot:nth-child(2) {
  animation-delay: 0.2s;
}

.dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes bounce {

  0%,
  60%,
  100% {
    transform: translateY(0);
  }

  30% {
    transform: translateY(-6px);
  }
}

/* Chat input bar */
.chat-input {
  display: flex;
  gap: 12px;
  margin: 0;
  padding: 20px 40px;
  align-items: center;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-top: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
}

.chat-input input {
  flex: 1;
  padding: 14px 20px;
  border: 2px solid rgba(232, 232, 232, 0.8);
  border-radius: 12px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 14px;
  outline: none;
  transition: all 0.3s;
  background: rgba(250, 250, 250, 0.8);
  backdrop-filter: blur(10px);
}

.chat-input input:focus {
  border-color: #e45700;
  background: white;
  box-shadow: 0 0 0 3px rgba(228, 87, 0, 0.15);
}

.chat-input input:disabled {
  background: rgba(245, 245, 245, 0.6);
  color: #999;
  cursor: not-allowed;
}

#micBtn {
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(10px);
  border: 2px solid rgba(232, 232, 232, 0.8);
  padding: 12px 14px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  height: 48px;
}

#micBtn:hover:not(:disabled) {
  background: #fff3e9;
  border-color: #e45700;
  transform: scale(1.08);
  box-shadow: 0 4px 12px rgba(228, 87, 0, 0.2);
}

#micBtn.mic-active {
  background: linear-gradient(135deg, #e44444, #ff5555);
  border-color: #e44444;
  animation: pulse 1.5s infinite;
}

#micBtn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

#sendBtn {
  padding: 14px 28px;
  margin: 0;
  border-radius: 12px;
  height: 48px;
  font-weight: 700;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }

  50% {
    opacity: 0.8;
    transform: scale(1.05);
  }
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

/* Anomaly badge */
.anomaly-badge {
  background: linear-gradient(135deg, #fff5f5, #ffe5e5);
  color: #e44444;
  border: 2px solid #ff9999;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(228, 68, 68, 0.15);
}

.turn-warning {
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 20px;
  margin: 6px auto;
  max-width: 360px;
  animation: fadeInUp 0.3s ease;
}

.turn-warning--info {
  background: #e8f4ff;
  color: #1a6fbb;
  border: 1px solid #a8d0f5;
}

.turn-warning--warning {
  background: #fff8e6;
  color: #b07800;
  border: 1px solid #f5d77a;
}

/* ── Responsive ────────────────────────────────────────────────────────────── */

@media (max-width: 900px) {
  .page {
    padding: 28px 20px;
  }

  .history-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
  }

  .session-meta {
    flex-direction: column;
    gap: 8px;
  }

  .chat-input {
    padding: 16px 20px;
  }
}

@media (max-width: 600px) {
  .page {
    padding: 20px 16px;
  }

  .history-grid {
    grid-template-columns: 1fr;
  }

  .center {
    margin-top: 80px;
  }

  h1 {
    font-size: 32px;
  }

  h2 {
    font-size: 26px;
  }

  .chat-input {
    padding: 12px 16px;
    gap: 8px;
  }

  #micBtn {
    min-width: 44px;
    height: 44px;
    font-size: 18px;
  }

  #sendBtn {
    padding: 12px 20px;
    height: 44px;
  }
}

/* ── Form card (new session - legacy support) ────────────────────────────── */

.form-card {
  background: white;
  padding: 32px;
  border-radius: 16px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.08);
  max-width: 540px;
  margin: 0 auto;
  border: 1px solid #f5f5f5;
}

.form-card label {
  display: block;
  font-size: 12px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 700;
  color: #555;
  margin-top: 20px;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-card label:first-of-type {
  margin-top: 0;
}

.form-card select,
.form-card textarea {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #e8e8e8;
  border-radius: 10px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 14px;
  color: #333;
  background: white;
  transition: all 0.2s;
  appearance: none;
}

.form-card select:focus,
.form-card textarea:focus {
  outline: none;
  border-color: #e45700;
  box-shadow: 0 0 0 3px rgba(228, 87, 0, 0.1);
}

.form-card textarea {
  resize: vertical;
  min-height: 100px;
  display: none;
  margin-top: 8px;
  line-height: 1.6;
}

.form-card button {
  width: 100%;
  margin-top: 28px;
  padding: 15px;
  font-size: 15px;
  margin-left: 0;
  margin-right: 0;
}

/* ── Chat Empty State / Start Screen ─────────────────────────────────────── */

.start-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 24px 32px;
  gap: 18px;
  animation: startFadeIn 0.5s ease;
  /* Takes up the full chatbox, centering content */
  flex: 1;
  min-height: 100%;
}

.start-screen.dismissed {
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
}

@keyframes startFadeIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.start-icon {
  filter: drop-shadow(0 6px 16px rgba(228, 87, 0, 0.18));
}

.start-title {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 26px;
  letter-spacing: 1.5px;
  color: #1a1a1a;
  margin: 0;
}

.start-sub {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 14px;
  color: #888;
  max-width: 400px;
  line-height: 1.6;
  margin: 0;
}

.start-sub strong {
  color: #e45700;
  font-weight: 700;
}

.start-sub em {
  color: #555;
}

/* Tip rows */
.start-tips {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 420px;
  width: 100%;
}

.start-tip {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: white;
  border: 1.5px solid #f0f0f0;
  border-radius: 12px;
  padding: 10px 14px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 13px;
  color: #555;
  text-align: left;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.tip-icon {
  font-size: 16px;
  flex-shrink: 0;
  line-height: 1.3;
}

/* Quick-start chips */
.start-chips {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  max-width: 460px;
  width: 100%;
}

.start-chips-label {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: #ccc;
  margin: 0;
}

.start-chip {
  background: rgba(255, 255, 255, 0.85);
  border: 2px solid #e8e8e8;
  border-radius: 24px;
  padding: 9px 20px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: #444;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  width: 100%;
  text-align: center;
  line-height: 1.4;
}

.start-chip:hover {
  background: white;
  border-color: #e45700;
  color: #e45700;
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(228, 87, 0, 0.14);
}

.start-chip:active {
  transform: translateY(0);
}

@media (max-width: 600px) {
  .start-screen {
    padding: 28px 16px 24px;
    gap: 14px;
  }

  .start-title {
    font-size: 22px;
  }

  .start-tip {
    font-size: 12px;
    padding: 9px 12px;
  }

  .start-chip {
    font-size: 12px;
    padding: 8px 16px;
  }
}

/* ── Mode Toggle ────────────────────────────────────────────────────────────── */

.mode-toggle {
  display: flex;
  background: #f0f2f5;
  border-radius: 24px;
  padding: 4px;
  gap: 2px;
  border: 1.5px solid #e8e8e8;
}

.mode-btn {
  background: transparent;
  border: none;
  padding: 8px 18px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  font-family: 'Plus Jakarta Sans', sans-serif;
  color: #999;
  transition: all 0.25s ease;
  display: flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}

.mode-btn.active {
  background: white;
  color: #e45700;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.10);
}

.mode-btn.active svg {
  stroke: #e45700;
}

.mode-btn:not(.active):hover {
  color: #555;
  background: rgba(255, 255, 255, 0.55);
}

/* ── Voice Input Panel ───────────────────────────────────────────────────── */

.voice-input {
  display: none;
  /* shown via JS when mode = voice */
  flex: 1;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  background: linear-gradient(160deg, #fff8f4 0%, #fff3eb 50%, #fdf5ff 100%);
}

/* Ambient radial glow behind avatar */
.voice-input::before {
  content: '';
  position: absolute;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(228, 87, 0, 0.12) 0%, transparent 65%);
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 0;
}

/* Session timer chip — absolute top-left overlay */
.voice-timer {
  display: flex;
  align-items: center;
  gap: 8px;
  background: white;
  border: 1.5px solid #f0e8e0;
  border-radius: 24px;
  padding: 6px 14px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: #555;
  letter-spacing: 0.5px;
  flex-shrink: 0;
  transition: background 0.4s, border-color 0.4s, color 0.4s;
}

.voice-timer.urgent {
  background: #fff1f0;
  border-color: #e74c3c;
  color: #e74c3c;
}

.voice-timer.urgent .voice-rec-dot {
  background: #e74c3c;
}

/* Warning toast */
.timer-warning-toast {
  position: fixed;
  top: 72px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff3cd;
  border: 1.5px solid #f0ad00;
  border-radius: 28px;
  padding: 10px 22px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: #8a5e00;
  box-shadow: 0 6px 24px rgba(240, 173, 0, 0.22);
  animation: toastIn 0.35s ease forwards;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-14px);
  }

  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

.timer-toast-icon {
  font-size: 18px;
  line-height: 1;
}

.voice-rec-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #e45700;
  flex-shrink: 0;
  animation: recPulse 1.4s infinite ease-in-out;
}

@keyframes recPulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.2;
  }
}

/* Upper stage: avatar + name + status */
.voice-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 32px 16px;
  gap: 12px;
  position: relative;
  z-index: 1;
}

/* ── Avatar ── */
.voice-avatar-wrap {
  position: relative;
  width: 176px;
  height: 176px;
  margin-bottom: 4px;
}

.voice-avatar-img {
  width: 176px;
  height: 176px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid white;
  box-shadow: 0 16px 48px rgba(228, 87, 0, 0.18), 0 4px 16px rgba(0, 0, 0, 0.10);
  display: block;
  transition: box-shadow 0.5s ease;
}

.voice-customer-name {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 17px;
  font-weight: 700;
  color: #1a1a1a;
  margin-top: 12px;
  text-align: center;
  letter-spacing: 0.2px;
}

/* Idle ring */
.voice-avatar-wrap::before {
  content: '';
  position: absolute;
  inset: -12px;
  border-radius: 50%;
  border: 2.5px solid rgba(228, 87, 0, 0.30);
  animation: avatarRingIdle 3s infinite ease-in-out;
  pointer-events: none;
}

/* Outer secondary ring */
.voice-avatar-wrap::after {
  content: '';
  position: absolute;
  inset: -24px;
  border-radius: 50%;
  border: 1.5px solid rgba(228, 87, 0, 0.10);
  animation: avatarRingIdle 3s 0.4s infinite ease-in-out;
  pointer-events: none;
}

/* User is recording */
.voice-avatar-wrap.recording::before {
  border-color: rgba(220, 38, 38, 0.75);
  animation: avatarRingRecord 0.70s infinite ease-in-out;
}

.voice-avatar-wrap.recording::after {
  content: '';
  position: absolute;
  inset: -24px;
  border-radius: 50%;
  border: 1.5px solid rgba(220, 38, 38, 0.22);
  animation: avatarRingRecord 0.70s 0.15s infinite ease-in-out;
  pointer-events: none;
}

/* AI is speaking */
.voice-avatar-wrap.ai-speaking::before {
  border-color: rgba(37, 99, 235, 0.75);
  animation: avatarRingAI 1.1s infinite ease-in-out;
}

.voice-avatar-wrap.ai-speaking::after {
  border-color: rgba(37, 99, 235, 0.18);
  animation: avatarRingAI 1.1s 0.2s infinite ease-in-out;
}

@keyframes avatarRingIdle {

  0%,
  100% {
    transform: scale(1);
    opacity: 0.55;
  }

  50% {
    transform: scale(1.04);
    opacity: 1;
  }
}

@keyframes avatarRingRecord {

  0%,
  100% {
    transform: scale(1);
    opacity: 0.75;
  }

  50% {
    transform: scale(1.07);
    opacity: 1;
  }
}

@keyframes avatarRingAI {

  0%,
  100% {
    transform: scale(1);
    opacity: 0.65;
  }

  50% {
    transform: scale(1.05);
    opacity: 1;
  }
}

/* ── Persona name & badge ── */
.voice-persona-name {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 32px;
  letter-spacing: 3px;
  color: #1a1a1a;
  margin-top: 6px;
  text-shadow: none;
}

.voice-persona-badge {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 10px;
  font-weight: 700;
  color: #aaa;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  background: white;
  border: 1.5px solid #ececec;
  border-radius: 20px;
  padding: 4px 14px;
}

/* ── AI speaking chip ── */
.ai-speaking-chip {
  display: none;
  align-items: center;
  gap: 9px;
  background: #eff6ff;
  border: 1.5px solid #bfdbfe;
  border-radius: 24px;
  padding: 8px 18px;
  animation: voiceFadeIn 0.3s ease;
}

.ai-speaking-chip.visible {
  display: flex;
}

.ai-speaking-chip .ai-label {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 12px;
  font-weight: 700;
  color: #2563eb;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ── Waveform bars ── */
.wave-bars {
  display: flex;
  align-items: center;
  gap: 2.5px;
  height: 18px;
}

.wave-bar {
  width: 2.5px;
  background: #60a5fa;
  border-radius: 2px;
  animation: waveAnim 1s infinite ease-in-out;
}

.wave-bar:nth-child(1) {
  height: 5px;
  animation-delay: 0.00s;
}

.wave-bar:nth-child(2) {
  height: 11px;
  animation-delay: 0.10s;
}

.wave-bar:nth-child(3) {
  height: 16px;
  animation-delay: 0.20s;
}

.wave-bar:nth-child(4) {
  height: 13px;
  animation-delay: 0.30s;
}

.wave-bar:nth-child(5) {
  height: 7px;
  animation-delay: 0.15s;
}

.wave-bar:nth-child(6) {
  height: 14px;
  animation-delay: 0.25s;
}

.wave-bar:nth-child(7) {
  height: 9px;
  animation-delay: 0.35s;
}

@keyframes waveAnim {

  0%,
  100% {
    transform: scaleY(0.45);
    opacity: 0.6;
  }

  50% {
    transform: scaleY(1.3);
    opacity: 1;
  }
}

/* ── Lower section: live transcript + PTT ── */
.voice-bottom {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: 20px 32px 36px;
  background: rgba(255, 255, 255, 0.70);
  border-top: 1px solid rgba(228, 87, 0, 0.10);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  position: relative;
  z-index: 1;
}

/* ── Live transcript ── */
.voice-live-transcript {
  width: 100%;
  max-width: 400px;
  min-height: 48px;
  background: white;
  border: 2px solid #f0e8e0;
  border-radius: 14px;
  padding: 13px 20px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 14px;
  color: #c0b0a8;
  text-align: center;
  transition: all 0.3s ease;
  line-height: 1.6;
  box-shadow: 0 2px 12px rgba(228, 87, 0, 0.05);
}

.voice-live-transcript strong {
  color: #bbb;
}

.voice-live-transcript.active {
  background: white;
  border-color: #e45700;
  color: #1a1a1a;
  text-align: left;
  box-shadow: 0 0 0 3px rgba(228, 87, 0, 0.10);
}

/* ── PTT area ── */
.ptt-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

/* ── Button group (Cancel, Speak, Confirm) ── */
.ptt-button-group {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.ptt-status {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 11px;
  font-weight: 700;
  color: #bbb;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  height: 16px;
  transition: color 0.2s;
}

/* ── PTT button ── */
.ptt-btn {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: linear-gradient(135deg, #e45700, #ff7b2e);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 28px rgba(228, 87, 0, 0.50), 0 8px 32px rgba(0, 0, 0, 0.30);
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1),
    box-shadow 0.2s ease,
    background 0.25s ease;
  position: relative;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

/* Outer ring pulse */
.ptt-btn::after {
  content: '';
  position: absolute;
  inset: -12px;
  border-radius: 50%;
  border: 2px solid rgba(228, 87, 0, 0.22);
  pointer-events: none;
  animation: pttRingIdle 2.8s infinite ease-out;
}

.ptt-btn:hover:not(:disabled):not(.ptt-active):not(.ptt-ai-speaking) {
  transform: scale(1.10);
  box-shadow: 0 0 40px rgba(228, 87, 0, 0.65), 0 12px 40px rgba(0, 0, 0, 0.30);
}

.ptt-btn:disabled {
  opacity: 0.40;
  cursor: not-allowed;
}

.ptt-btn:disabled::after {
  display: none;
}

/* User is speaking */
.ptt-btn.ptt-active {
  background: linear-gradient(135deg, #dc2626, #ef4444);
  box-shadow: 0 0 28px rgba(220, 38, 38, 0.55), 0 8px 28px rgba(0, 0, 0, 0.30);
  transform: scale(0.94);
}

.ptt-btn.ptt-active::after {
  border-color: rgba(220, 38, 38, 0.35);
  animation: pttRingActive 0.75s infinite ease-out;
}

/* AI is speaking */
.ptt-btn.ptt-ai-speaking {
  background: linear-gradient(135deg, #1d4ed8, #3b82f6);
  box-shadow: 0 0 28px rgba(59, 130, 246, 0.45), 0 8px 28px rgba(0, 0, 0, 0.30);
  cursor: pointer;
}

.ptt-btn.ptt-ai-speaking::after {
  border-color: rgba(59, 130, 246, 0.30);
  animation: pttRingBlue 1.2s infinite ease-out;
}

/* ── Action buttons (Cancel/Confirm) ── */
.ptt-action-btn {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 3px solid white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  color: white;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
  position: relative;
  overflow: hidden;
}

.ptt-action-btn::before {
  content: '';
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}

.ptt-cancel-btn {
  background: linear-gradient(135deg, #ef4444, #f87171);
  box-shadow: 0 6px 24px rgba(239, 68, 68, 0.40);
}

.ptt-cancel-btn::before {
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.30);
}

.ptt-cancel-btn:hover {
  transform: scale(1.12);
  box-shadow: 0 8px 32px rgba(239, 68, 68, 0.50);
}

.ptt-cancel-btn:hover::before {
  opacity: 1;
}

.ptt-cancel-btn:active {
  transform: scale(0.94);
}

.ptt-confirm-btn {
  background: linear-gradient(135deg, #10b981, #34d399);
  box-shadow: 0 6px 24px rgba(16, 185, 129, 0.40);
}

.ptt-confirm-btn::before {
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.30);
}

.ptt-confirm-btn:hover {
  transform: scale(1.12);
  box-shadow: 0 8px 32px rgba(16, 185, 129, 0.50);
}

.ptt-confirm-btn:hover::before {
  opacity: 1;
}

.ptt-confirm-btn:active {
  transform: scale(0.94);
}

@keyframes pttRingIdle {
  0% {
    transform: scale(1);
    opacity: 0.55;
  }

  100% {
    transform: scale(1.55);
    opacity: 0;
  }
}

@keyframes pttRingActive {
  0% {
    transform: scale(1);
    opacity: 0.65;
  }

  100% {
    transform: scale(1.3);
    opacity: 0;
  }
}

@keyframes pttRingBlue {
  0% {
    transform: scale(1);
    opacity: 0.55;
  }

  100% {
    transform: scale(1.45);
    opacity: 0;
  }
}

/* Keyboard hint */
.ptt-hint {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 11px;
  color: #ccc;
  display: flex;
  align-items: center;
  gap: 5px;
}

.ptt-hint kbd {
  background: #f5f5f5;
  border: 1px solid #e0e0e0;
  border-bottom: 2px solid #d0d0d0;
  border-radius: 4px;
  padding: 2px 7px;
  font-size: 10px;
  color: #888;
  font-family: monospace;
}

@keyframes voiceFadeIn {
  from {
    opacity: 0;
    transform: translateY(-5px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Responsive */
@media (max-width: 600px) {
  .voice-stage {
    padding: 48px 20px 12px;
    gap: 10px;
  }

  .voice-avatar-wrap {
    width: 148px;
    height: 148px;
  }

  .voice-avatar-img {
    width: 148px;
    height: 148px;
  }

  .ptt-btn {
    width: 76px;
    height: 76px;
  }

  .ptt-action-btn {
    width: 52px;
    height: 52px;
  }

  .ptt-action-btn svg {
    width: 20px;
    height: 20px;
  }

  .ptt-button-group {
    gap: 14px;
  }

  .mode-btn {
    padding: 7px 13px;
    font-size: 12px;
  }

  .voice-bottom {
    padding: 18px 20px 28px;
    gap: 14px;
  }
}

/* ── History ──────────────────────────────────────────────────────────────── */

.history-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
  margin-top: 32px;
}

.history-card {
  background: white;
  padding: 24px;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
  border: 2px solid transparent;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(10px);
}

.history-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #e45700, #ff7b2e);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.history-card:hover::before {
  transform: scaleX(1);
}

.history-card:hover {
  border-color: #e45700;
  box-shadow: 0 16px 48px rgba(228, 87, 0, 0.2);
  transform: translateY(-6px);
}

.history-card h3 {
  font-family: 'Plus Jakarta Sans', sans-serif;
  color: #1a1a1a;
  font-size: 20px;
  letter-spacing: 1px;
  margin-bottom: 4px;
}

.history-card p {
  font-size: 13px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  color: #666;
  line-height: 1.5;
}

.history-card .date {
  font-size: 11px;
  color: #aaa;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 4px;
}

.history-card button {
  margin: 12px 0 0 0;
  padding: 11px 20px;
  font-size: 13px;
  width: 100%;
}

.empty-state {
  text-align: center;
  color: #aaa;
  padding: 100px 20px;
  font-size: 15px;
  font-family: 'Plus Jakarta Sans', sans-serif;
}

.empty-state p {
  font-size: 16px;
  margin-bottom: 20px;
}

.empty-state button {
  margin-top: 20px;
}

/* ── Responsive ────────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
  .page {
    padding: 20px 16px;
  }

  .history-grid {
    grid-template-columns: 1fr;
  }

  .session-meta {
    flex-direction: column;
    gap: 6px;
  }

  .nav-links {
    display: none;
  }

  .chatbox {
    margin: 12px;
  }

  .chat-input {
    margin: 0 12px 12px;
  }
}


/* ── Analysis page — JSON structured display ─────────────────────────────── */

.score-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
}

.overall-text {
  color: #555;
  margin-top: 6px;
  line-height: 1.6;
  font-size: 14px;
}

.overall-score-badge {
  background: #fff3e9;
  border: 2px solid #e45700;
  border-radius: 12px;
  padding: 10px 18px;
  text-align: center;
  flex-shrink: 0;
  min-width: 80px;
}

.score-num {
  font-size: 32px;
  font-weight: bold;
  color: #e45700;
  line-height: 1;
}

.score-denom {
  font-size: 16px;
  color: #aaa;
}

/* Score bars */
.scores-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 8px;
}

.score-row {
  display: flex;
  align-items: center;
  gap: 16px;
}

.score-label-wrap {
  min-width: 160px;
}

.score-label {
  font-size: 14px;
  font-weight: bold;
  color: #333;
  display: block;
}

.score-note {
  font-size: 12px;
  color: #888;
  display: block;
  margin-top: 2px;
  line-height: 1.3;
}

.score-bar-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
}

.score-bar {
  flex: 1;
  height: 10px;
  background: #f0f0f0;
  border-radius: 5px;
  overflow: hidden;
}

.score-fill {
  height: 100%;
  border-radius: 5px;
  transition: width 0.6s ease;
}

.fill-high {
  background: #27ae60;
}

.fill-mid {
  background: #e45700;
}

.fill-low {
  background: #e44444;
}

.score-value {
  font-size: 13px;
  font-weight: bold;
  color: #333;
  min-width: 36px;
  text-align: right;
}

/* Key moments */
.moments-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 8px;
}

.moment-item {
  border-left: 3px solid #e45700;
  padding-left: 14px;
}

.moment-quote {
  font-size: 14px;
  color: #333;
  font-style: italic;
  margin-bottom: 4px;
}

.moment-insight {
  font-size: 13px;
  color: #666;
  line-height: 1.5;
}

/* Two-column strengths / improvements */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

@media (max-width: 640px) {
  .two-col {
    grid-template-columns: 1fr;
  }
}

.card-title-green {
  color: #27ae60;
}

.card-title-orange {
  color: #e45700;
}

.bullet-list {
  list-style: none;
  padding: 0;
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bullet-list li {
  font-size: 13px;
  color: #555;
  line-height: 1.5;
  padding-left: 18px;
  position: relative;
}

.bullet-list li::before {
  content: '•';
  position: absolute;
  left: 0;
  font-weight: bold;
}

.bullet-list.green li::before {
  color: #27ae60;
}

.bullet-list.orange li::before {
  color: #e45700;
}

/* Recommendations */
.recs-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 8px;
}

.rec-item {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.rec-number {
  width: 30px;
  height: 30px;
  background: #e45700;
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 14px;
  flex-shrink: 0;
  margin-top: 2px;
}

.rec-body {
  flex: 1;
}

.rec-title {
  font-weight: bold;
  font-size: 14px;
  color: #222;
  margin-bottom: 4px;
}

.rec-detail {
  font-size: 13px;
  color: #666;
  line-height: 1.5;
}

/* Anomaly card */
.anomaly-card {
  border-left: 4px solid #e44444;
  background: #fff8f8;
}

.anomaly-card h3 {
  color: #e44444;
}

.anomaly-card p {
  font-size: 13px;
  color: #666;
  margin-top: 6px;
}

/* Call transcript log */
.call-log {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 12px;
  max-height: 400px;
  overflow-y: auto;
  padding-right: 4px;
}

.call-log::-webkit-scrollbar {
  width: 4px;
}

.call-log::-webkit-scrollbar-thumb {
  background: #ddd;
  border-radius: 2px;
}

.call-line {
  display: flex;
  flex-direction: column;
  max-width: 75%;
}

.call-line-user {
  align-self: flex-end;
  align-items: flex-end;
}

.call-line-ai {
  align-self: flex-start;
  align-items: flex-start;
}

.call-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 3px;
}

.call-role {
  font-size: 11px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: #aaa;
}

.call-time {
  font-size: 11px;
  color: #ccc;
}

.call-bubble {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.5;
  word-break: break-word;
}

.call-line-user .call-bubble {
  background: #e45700;
  color: white;
}

.call-line-ai .call-bubble {
  background: #f5f5f5;
  color: #333;
  border: 1px solid #eee;
}