@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800&family=Playfair+Display:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500&display=swap');

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

:root {
  --bg:           #FAFCFB;
  --bg-warm:      #F8FAFC;
  --surface:      #ffffff;
  --surface-raised:#FAFCFB;
  --border:       #E2E8F0;
  --border-light: #F1F5F9;
  --primary:      #1E293B;
  --green:        #0D9488;
  --green-mid:    #0F766E;
  --green-light:  #F0FDFA;
  --green-faint:  #F0FDFA;
  --amber:        #D97706;
  --amber-light:  #FFF7ED;
  --red:          #DC2626;
  --red-light:    #FEF2F2;
  --text:         #1E293B;
  --muted:        #64748B;
  --faint:        #94A3B8;
  --white:        #ffffff;

  --teal-600: #0D9488;
  --teal-700: #0F766E;
  --teal-50:  #F0FDFA;
  --teal-100: #CCFBF1;
  --slate-800: #1E293B;
  --slate-700: #334155;
  --slate-600: #475569;
  --slate-500: #64748B;
  --slate-400: #94A3B8;
  --slate-300: #CBD5E1;
  --slate-200: #E2E8F0;
  --slate-100: #F1F5F9;
  --slate-50:  #F8FAFC;
  --green-500: #0D9488;
  --green-50:  #F0FDFA;
  --green-200: #99F6E4;
  --amber-500: #D97706;
  --amber-50:  #FFF7ED;
  --amber-200: #FED7AA;
  --amber-100: #FFF7ED;
  --red-500:   #DC2626;
  --red-50:    #FEF2F2;
  --red-200:   #FECACA;
  --blue-50:   #EFF6FF;
  --blue-200:  #BFDBFE;
  --blue-500:  #3B82F6;
  --violet-500: #7C3AED;
  --yellow-100: #FEF3C7;
  --yellow-300: #FDE68A;
  --yellow-800: #92400E;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.04);
  --shadow-md: 0 2px 8px rgba(0,0,0,0.06);
  --shadow-lg: 0 2px 12px rgba(0,0,0,0.06);
  --shadow-hover: 0 4px 12px rgba(13,148,136,0.2);
  --transition: 0.2s ease;

  --sidebar-w: 216px;
  --sidebar-collapsed: 56px;
}

html, body {
  height: 100%;
  font-family: 'DM Sans', 'Avenir Next', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

#app {
  display: flex;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

#verify-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: var(--amber-light);
  border-bottom: 1px solid var(--amber);
  color: #92400E;
  font-size: 13px;
  flex-shrink: 0;
}

#verify-banner span { flex: 1; }

#verify-banner #resend-verify-btn {
  background: none;
  border: 1px solid var(--amber);
  color: var(--amber);
  padding: 3px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

#verify-banner #resend-verify-btn:hover {
  background: var(--amber);
  color: white;
}

#verify-banner #dismiss-verify-btn {
  background: none;
  border: none;
  color: #92400E;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  padding: 0 4px;
  opacity: 0.6;
}

#verify-banner #dismiss-verify-btn:hover { opacity: 1; }

.hidden { display: none !important; }

::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  padding: 20px;
}

.login-card {
  width: 100%;
  max-width: 360px;
  text-align: center;
}

.login-logo {
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.login-logo svg { flex-shrink: 0; }

.login-wordmark {
  font-family: 'DM Sans', sans-serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: -0.3px;
}

.login-wordmark span {
  font-weight: 400;
  color: var(--green);
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.login-input {
  padding: 12px 16px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 15px;
  font-family: inherit;
  outline: none;
  text-align: center;
  background: var(--surface);
  color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.login-input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(13,148,136,0.08);
}

.login-btn {
  padding: 12px 20px;
  border: none;
  border-radius: 10px;
  background: var(--primary);
  color: white;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background var(--transition);
}

.login-btn:hover { background: #0a2030; }

.login-error {
  color: var(--red);
  font-size: 13px;
  margin: 0;
}

.login-toggle {
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  margin: 4px 0 0;
}

.login-toggle-link {
  background: none;
  border: none;
  color: var(--green);
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  text-decoration: underline;
  padding: 0;
}

.login-toggle-link:hover { color: var(--green-mid); }

.login-form .login-input + .login-input { margin-top: 8px; }

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transition: width 0.22s cubic-bezier(0.4,0,0.2,1);
  overflow: hidden;
  z-index: 10;
}

.sidebar.sidebar-collapsed {
  width: var(--sidebar-collapsed);
}

.sidebar-logo-row {
  padding: 18px 16px 16px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.sidebar-collapsed .sidebar-logo-row {
  padding: 18px 0 16px;
  justify-content: center;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-wordmark {
  font-family: 'DM Sans', sans-serif;
  font-size: 17px;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: -0.3px;
  white-space: nowrap;
}

.sidebar-wordmark span { font-weight: 400; color: var(--green); }

.sidebar-collapsed .sidebar-wordmark { display: none; }

.sidebar-collapse-btn {
  background: none;
  border: none;
  color: var(--faint);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  transition: color var(--transition);
}

.sidebar-collapse-btn:hover { color: var(--text); }
.sidebar-collapsed .sidebar-collapse-btn { display: none; }

.sidebar-new-wrap {
  padding: 12px 12px 8px;
  flex-shrink: 0;
}

.sidebar-collapsed .sidebar-new-wrap { padding: 12px 8px 8px; }

.sidebar-new-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-warm);
  cursor: pointer;
  font-family: inherit;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  transition: all 0.12s;
}

.sidebar-collapsed .sidebar-new-btn {
  padding: 8px;
  justify-content: center;
}

.sidebar-new-btn:hover {
  background: var(--green-faint);
  border-color: rgba(13,148,136,0.4);
  color: var(--green);
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 4px 0 12px;
}

.sidebar-section-label {
  padding: 10px 16px 4px;
  font-size: 10px;
  font-weight: 700;
  color: var(--faint);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.sidebar-collapsed .sidebar-section-label { display: none; }
.sidebar-collapsed .sidebar-section { padding-top: 10px; }

.sidebar-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 16px;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  font-weight: 400;
  background: transparent;
  color: var(--muted);
  border-left: 2.5px solid transparent;
  transition: all 0.12s;
  text-align: left;
  text-decoration: none;
}

.sidebar-collapsed .sidebar-item {
  padding: 9px 0;
  justify-content: center;
}

.sidebar-item:hover {
  background: var(--bg-warm);
  color: var(--text);
}

.sidebar-item.active {
  background: var(--green-faint);
  color: var(--green);
  font-weight: 600;
  border-left-color: var(--green);
}

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

.sidebar-badge {
  margin-left: auto;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--green);
  color: var(--white);
  font-size: 11px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.sidebar-collapsed .sidebar-badge { display: none; }

.sidebar-expand-row {
  padding: 12px 0;
  border-top: 1px solid var(--border-light);
  display: flex;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-expand-btn {
  background: none;
  border: none;
  color: var(--faint);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  display: flex;
}

.sidebar-expand-btn:hover { color: var(--text); }

.sidebar-admin-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-top: 1px solid var(--border-light);
  font-size: 12px;
  color: #0D9488;
  text-decoration: none;
  flex-shrink: 0;
  cursor: pointer;
  transition: background 0.15s;
}
.sidebar-admin-link:hover { background: rgba(13,148,136,0.06); }
.sidebar-admin-link.hidden { display: none; }
.sidebar-collapsed .sidebar-admin-link .sidebar-label { display: none; }

.sidebar-version {
  padding: 10px 16px;
  border-top: 1px solid var(--border-light);
  font-size: 10px;
  color: var(--faint);
  flex-shrink: 0;
  white-space: nowrap;
  overflow: hidden;
}

.sidebar-collapsed .sidebar-version { display: none; }

.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
  position: relative;
}

.top-bar {
  height: 52px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  flex-shrink: 0;
  gap: 12px;
}

.top-bar-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mobile-menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.mobile-menu-btn:hover { background: var(--bg-warm); color: var(--text); }

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}

.top-bar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.top-bar-divider {
  width: 1px;
  height: 18px;
  background: var(--border-light);
}

.mode-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: transparent;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}

.mode-icon {
  font-size: 14px;
  line-height: 1;
}

.zone-pill-wrap { position: relative; }

.zone-pill {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  transition: all var(--transition);
  cursor: pointer;
}

.zone-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.zone-green {
  background: var(--green-light);
  color: var(--green);
  border: 1px solid rgba(13,148,136,0.3);
}
.zone-green .zone-dot { background: #22c55e; }

.zone-amber {
  background: var(--amber-light);
  color: var(--amber);
  border: 1px solid rgba(200,120,15,0.3);
}
.zone-amber .zone-dot { background: #f59e0b; }

.zone-red {
  background: var(--red-light);
  color: var(--red);
  border: 1px solid rgba(192,57,43,0.3);
}
.zone-red .zone-dot {
  background: #ef4444;
  animation: zonePulse 2s ease-in-out infinite;
}

@keyframes zonePulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

@keyframes zoneFlash {
  0% { transform: scale(1); }
  50% { transform: scale(1.1); box-shadow: 0 0 12px rgba(0,0,0,0.15); }
  100% { transform: scale(1); }
}
.zone-flash { animation: zoneFlash 0.5s ease; }

.zone-tooltip {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  width: 300px;
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  z-index: 300;
  padding: 16px;
  animation: dropdownFadeIn 0.15s ease;
}

.zone-tooltip.hidden { display: none; }

.zone-tooltip-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 0;
}

.zone-tooltip-row + .zone-tooltip-row {
  border-top: 1px solid var(--border-light);
}

.zone-tooltip-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 3px;
}

.zone-tooltip-green .zone-tooltip-dot { background: var(--green); }
.zone-tooltip-amber .zone-tooltip-dot { background: var(--amber); }
.zone-tooltip-red .zone-tooltip-dot { background: var(--red); }

.zone-tooltip-row strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}

.zone-tooltip-row p {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
  margin: 0;
}

.zone-context-bar {
  background: var(--green-light);
  border-bottom: 1px solid rgba(13,148,136,0.15);
  padding: 8px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.zone-context-bar.hidden { display: none; }

.zone-context-bar.zone-ctx-amber {
  background: var(--amber-light);
  border-bottom-color: rgba(200,120,15,0.15);
}

.zone-context-bar.zone-ctx-red {
  background: var(--red-light);
  border-bottom-color: rgba(192,57,43,0.15);
}

.zone-context-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.zone-ctx-amber .zone-context-dot { background: #f59e0b; }
.zone-ctx-red .zone-context-dot { background: #ef4444; }

.zone-context-label {
  font-size: 12px;
  font-weight: 600;
}

.zone-ctx-amber .zone-context-label { color: var(--amber); }
.zone-ctx-red .zone-context-label { color: var(--red); }

.zone-context-desc {
  font-size: 12px;
  color: var(--muted);
}

.zone-context-clear {
  margin-left: auto;
  font-size: 11px;
  color: var(--faint);
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
}

.zone-context-clear:hover { color: var(--text); }

.persona-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 8px;
  background: var(--blue-50);
  border: 1px solid var(--blue-200);
  font-size: 13px;
  font-weight: 500;
  color: var(--blue-500);
}

.btn-new {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: transparent;
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
}

.btn-new:hover {
  background: var(--green-faint);
  border-color: rgba(13,148,136,0.4);
  color: var(--green);
}

.chat-container {
  flex: 1;
  overflow-y: auto;
  padding: 20px 20px 100px;
  background: var(--bg);
}

.welcome-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 20px 20px;
  text-align: center;
  max-width: 680px;
  margin: 0 auto;
  width: 100%;
  min-height: calc(100vh - 200px);
}

.welcome-eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--green);
  margin-bottom: 18px;
}

.welcome-heading {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 42px;
  font-weight: 600;
  color: var(--primary);
  line-height: 1.2;
  margin-bottom: 14px;
  letter-spacing: -0.02em;
}

.welcome-heading em {
  font-style: italic;
  color: var(--green);
  font-weight: 300;
}

.welcome-subtext {
  font-size: 15px;
  color: var(--muted);
  max-width: 420px;
  margin-bottom: 36px;
  line-height: 1.65;
}

.starter-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  width: 100%;
  max-width: 560px;
  margin-bottom: 28px;
}

.starter-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: all 0.15s;
  position: relative;
}

.starter-card:hover {
  border-color: rgba(13,148,136,0.4);
  background: var(--green-faint);
}

.starter-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--green);
}

.starter-quote {
  font-size: 13px;
  color: var(--text);
  line-height: 1.45;
  font-style: italic;
}

.starter-arrow {
  font-size: 12px;
  color: var(--faint);
  margin-top: 4px;
}

.starter-card:hover .starter-arrow { color: var(--green); }

.messages {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.message {
  display: flex;
  animation: msgIn 0.4s ease forwards;
}

@keyframes msgIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.agent-message {
  align-self: flex-start;
  gap: 10px;
  align-items: flex-start;
  max-width: 88%;
}

.user-message {
  align-self: flex-end;
  justify-content: flex-end;
  max-width: 72%;
}

.agent-avatar {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--green-light);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}

.agent-avatar.in-character {
  background: #FEF3C7;
}
.agent-avatar.director-avatar {
  background: #DBEAFE;
}

.agent-message-wrapper {
  max-width: calc(100% - 32px);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.in-character-label {
  font-size: 11px;
  font-weight: 600;
  color: #92400E;
  letter-spacing: 0.3px;
}
.director-label {
  font-size: 11px;
  font-weight: 600;
  color: #1E40AF;
  letter-spacing: 0.3px;
}

.escalation-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 8px;
  background: var(--red-light);
  border: 1px solid var(--red-200);
  font-size: 12px;
  font-weight: 600;
  color: var(--red);
}

.escalation-bar.escalation-confirmed {
  background: #ecfdf5;
  border-color: #a7f3d0;
  color: #059669;
}

.escalation-bar.escalation-confirmed .pulse-dot {
  background: #059669;
  animation: none;
}

.escalation-bar .pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--red);
  animation: zonePulse 2s ease-in-out infinite;
  flex-shrink: 0;
}

.algee-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 6px;
  background: var(--green-faint);
  border: 1px solid var(--teal-100);
  font-size: 12px;
  font-weight: 600;
  color: var(--green);
  align-self: flex-start;
}

.mhfa-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 6px;
  background: var(--green-faint);
  border: 1px solid var(--teal-100);
  font-size: 11px;
  color: var(--green);
  align-self: flex-start;
}

.scenario-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 6px;
  background: var(--bg-warm);
  font-size: 11px;
  color: var(--faint);
  align-self: flex-start;
}

.recommendation-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 8px;
  background: var(--amber-light);
  border: 1px solid var(--amber-200);
  font-size: 12px;
  color: var(--amber);
  align-self: flex-start;
  cursor: help;
  position: relative;
}

.recommendation-badge .rec-icon { font-size: 13px; line-height: 1; }
.recommendation-badge strong { font-weight: 700; }
.recommendation-badge .rec-detail { opacity: 0.6; }

.message-content {
  padding: 10px 16px;
  line-height: 1.7;
  word-wrap: break-word;
  overflow-wrap: break-word;
  font-size: 14px;
}

.agent-message .message-content {
  background: transparent;
  color: var(--text);
  border: none;
  border-radius: 0;
  box-shadow: none;
}

.agent-message .message-content.streaming::after {
  content: '\258C';
  animation: blink-cursor 0.8s steps(2) infinite;
  color: var(--green);
  font-weight: 300;
}

@keyframes blink-cursor {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.agent-message .message-content.escalation-content {
  border-left: 3px solid var(--red);
  padding-left: 14px;
}

.agent-message .message-content.in-character-content {
  background: #FFFBEB;
  border-radius: 8px;
  border: 1px solid #FDE68A;
}

.user-message .message-content {
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 12px 12px 3px 12px;
}

.message-content p { margin-bottom: 10px; }
.message-content p:last-child { margin-bottom: 0; }
.message-content strong { font-weight: 600; }
.message-content em { color: var(--muted); }
.user-message .message-content em { color: rgba(255,255,255,0.8); }

.message-content ul,
.message-content ol {
  margin: 8px 0;
  padding-left: 20px;
}

.message-content li { margin-bottom: 4px; }
.message-content li::marker { color: var(--green); }
.user-message .message-content li::marker { color: rgba(255,255,255,0.6); }

.message-content h3 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 15px;
  font-weight: 600;
  margin: 14px 0 6px;
  letter-spacing: -0.02em;
}

.message-content code {
  background: var(--bg-warm);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 13px;
  font-family: 'SF Mono', 'Fira Code', monospace;
}

.message-content blockquote {
  border-left: 3px solid var(--green);
  padding: 4px 12px;
  margin: 8px 0;
  color: var(--muted);
  background: var(--green-faint);
  border-radius: 0 8px 8px 0;
}

.coach-note {
  margin: 8px 0 16px 32px;
  padding: 12px 16px;
  background: var(--green-faint);
  border-left: 3px solid var(--green);
  border-radius: 0 10px 10px 0;
  font-size: 13.5px;
  color: var(--green);
  line-height: 1.6;
}

.coach-note-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
  opacity: 0.7;
}

.system-message {
  text-align: center;
  padding: 12px 16px;
  background: var(--bg-warm);
  border-radius: 10px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
  max-width: 680px;
  margin: 0 auto;
}

.error-message {
  text-align: center;
  padding: 12px 16px;
  background: var(--bg-warm);
  border-radius: 10px;
  font-size: 13px;
  color: var(--red);
  line-height: 1.5;
  max-width: 680px;
  margin: 0 auto;
}

.retry-btn {
  display: inline-block;
  margin-top: 8px;
  padding: 6px 16px;
  border: 1.5px solid var(--green);
  border-radius: 20px;
  background: var(--surface);
  color: var(--green);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
}

.retry-btn:hover {
  background: var(--green);
  color: white;
}

.draft-banner {
  background: repeating-linear-gradient(45deg, var(--amber-light), var(--amber-light) 10px, var(--amber-100) 10px, var(--amber-100) 20px);
  padding: 8px 16px;
  text-align: center;
  border-bottom: 1px solid var(--amber-200);
  border-radius: 14px 14px 0 0;
}

.draft-banner span {
  font-size: 12px;
  font-weight: 700;
  color: var(--amber);
  letter-spacing: 1px;
}

.template-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  margin: 8px 0 16px 0;
}

.template-title {
  padding: 16px 20px 8px;
  border-bottom: 1px solid var(--border-light);
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}

.template-body { padding: 12px 20px 16px; }

.template-field {
  display: flex;
  gap: 8px;
  padding: 4px 0;
  font-size: 13.5px;
}

.template-field-label {
  font-weight: 600;
  color: var(--muted);
  min-width: 90px;
}

.template-field-value { color: var(--text); }
.template-field-value.placeholder { color: var(--violet-500); }

.template-section { margin-top: 12px; }
.template-section-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}
.template-section-text {
  font-size: 13.5px;
  color: var(--muted);
  line-height: 1.6;
}

.template-guidance {
  margin-top: 8px;
  padding: 8px 12px;
  background: var(--yellow-100);
  border-radius: 6px;
  border: 1px solid var(--yellow-300);
  font-size: 12.5px;
  color: var(--yellow-800);
  font-style: italic;
  line-height: 1.5;
}

.draft-watermark {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-25deg);
  font-size: 44px;
  font-weight: 800;
  color: rgba(200,120,15,0.08);
  pointer-events: none;
  z-index: 1000;
  white-space: nowrap;
  letter-spacing: 6px;
  text-transform: uppercase;
}

.draft-watermark.hidden { display: none; }

.typing-indicator {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 4px;
  max-width: 680px;
  margin-left: auto;
  margin-right: auto;
}

.typing-indicator.hidden { display: none; }

.typing-bubble {
  display: flex;
  gap: 4px;
}

.typing-bubble span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  opacity: 0.4;
  animation: dotPulse 1.2s ease-in-out infinite;
}

.typing-bubble span:nth-child(2) { animation-delay: 0.2s; }
.typing-bubble span:nth-child(3) { animation-delay: 0.4s; }

@keyframes dotPulse {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}

.bottom-bar {
  position: relative;
  flex-shrink: 0;
  background: var(--bg);
  padding: 16px 28px 24px;
}

.bottom-inner {
  max-width: 680px;
  margin: 0 auto;
}

.action-buttons {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
  justify-content: center;
  flex-wrap: wrap;
}

.action-buttons::-webkit-scrollbar { display: none; }

.action-btn {
  flex-shrink: 0;
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}

.action-btn:hover {
  border-color: var(--green);
  color: var(--green);
}

.input-wrapper {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface);
  border-radius: 12px;
  border: 1.5px solid var(--border);
  box-shadow: 0 1px 8px rgba(0,0,0,0.05);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.input-wrapper:focus-within {
  border-color: var(--green);
  box-shadow: 0 1px 8px rgba(13,148,136,0.1);
}

.message-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 14px;
  color: var(--text);
  font-family: inherit;
  background: transparent;
  resize: none;
  min-height: 24px;
  max-height: 120px;
  line-height: 1.5;
  padding: 2px 0;
}

.message-input::placeholder { color: var(--faint); }

.send-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: none;
  background: var(--green);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s;
}

.send-btn:hover { background: var(--green-mid); }
.send-btn:disabled { background: var(--border); color: var(--faint); cursor: default; }

.chat-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  padding: 0 4px;
}

.chat-footer span {
  font-size: 11px;
  color: var(--faint);
}

#voice-tip {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 12px 20px;
  padding: 12px 16px;
  background: #F0FDFA;
  border: 1px solid #99F6E4;
  border-radius: 10px;
  font-size: 13px;
  color: #115E59;
  line-height: 1.5;
}
#voice-tip svg {
  flex-shrink: 0;
  margin-top: 2px;
  color: #0D9488;
}

.rehearsal-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
  transition: background 0.3s ease, border-color 0.3s ease;
}

.rehearsal-banner.scene-active {
  background: #FEFCE8;
  border-bottom-color: #FDE68A;
}
.rehearsal-banner.director-active {
  background: #EFF6FF;
  border-bottom-color: #BFDBFE;
}

.rehearsal-banner-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.rehearsal-banner-right {
  display: flex;
  align-items: center;
  gap: 6px;
}
.scene-mode-label {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.scene-active .scene-mode-label {
  background: #FEF3C7;
  color: #92400E;
}
.director-active .scene-mode-label {
  background: #DBEAFE;
  color: #1E40AF;
}
.scene-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.scene-active .scene-dot {
  background: #F59E0B;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2);
  animation: scenePulse 2s ease-in-out infinite;
}
.director-active .scene-dot {
  background: #3B82F6;
}

@keyframes scenePulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2); }
  50% { box-shadow: 0 0 0 5px rgba(245, 158, 11, 0.1); }
}

.rehearsal-ctrl-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid;
  transition: all 0.15s ease;
  font-family: inherit;
}
.pause-btn { background: #FEF3C7; color: #92400E; border-color: #FDE68A; }
.pause-btn:hover { background: #FDE68A; }
.resume-btn { background: #DBEAFE; color: #1E40AF; border-color: #93C5FD; }
.resume-btn:hover { background: #BFDBFE; }
.end-btn { background: var(--surface); color: var(--muted); border-color: var(--border); }
.end-btn:hover { background: var(--bg); color: var(--text); }
.rehearsal-banner.hidden { display: none; }

.voice-toggle-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border: 1.5px solid var(--green);
  border-radius: 20px;
  background: white;
  color: var(--green);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}

.voice-toggle-btn:hover { background: var(--green-faint); }
.voice-toggle-btn.voice-active { background: var(--green); color: white; }
.voice-toggle-btn.voice-active svg { stroke: white; }

.mic-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--faint);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  flex-shrink: 0;
}

.mic-btn:hover { color: var(--green); }

.mic-btn.mic-active {
  background: #ef4444;
  color: white;
  animation: micPulse 1.5s ease-in-out infinite;
}
.mic-btn.mic-active svg { stroke: white; }

@keyframes micPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.3); }
  50% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
}

.progress-bar {
  flex-shrink: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border-light);
  padding: 10px 20px;
}

.progress-stages {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  max-width: 520px;
  margin: 0 auto;
}

.progress-stage {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 500;
  color: var(--faint);
  transition: all 0.3s ease;
  white-space: nowrap;
}

.progress-stage.active {
  color: var(--green);
  background: var(--green-faint);
  font-weight: 600;
}

.progress-stage.completed { color: var(--green); }

.progress-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.progress-stage.active .progress-dot {
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(13,148,136,0.15);
}

.progress-stage.completed .progress-dot { background: var(--green); }

.progress-connector {
  width: 24px;
  height: 2px;
  background: var(--border);
  flex-shrink: 0;
  transition: background 0.3s ease;
}

.progress-connector.completed { background: var(--green); }

.docs-panel,
.history-panel,
.notes-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 380px;
  max-width: 100vw;
  height: 100vh;
  height: 100dvh;
  background: var(--surface);
  box-shadow: -4px 0 24px rgba(0,0,0,0.1);
  z-index: 200;
  display: flex;
  flex-direction: column;
  animation: slideIn 0.25s ease;
}

.docs-panel.hidden,
.history-panel.hidden,
.notes-panel.hidden { display: none; }

@keyframes slideIn {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

.docs-panel-header,
.history-panel-header,
.notes-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
}

.docs-panel-header h2,
.history-panel-header h2,
.notes-panel-header h2 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 20px;
  font-weight: 600;
  color: var(--primary);
}

.docs-panel-close,
.history-panel-close,
.notes-panel-close {
  width: 32px;
  height: 32px;
  border: none;
  background: none;
  color: var(--faint);
  font-size: 24px;
  cursor: pointer;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.docs-panel-close:hover,
.history-panel-close:hover,
.notes-panel-close:hover {
  background: var(--bg-warm);
  color: var(--text);
}

.docs-list,
.history-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

.docs-empty,
.history-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 24px;
  text-align: center;
  color: var(--faint);
  gap: 12px;
}

.docs-empty p,
.history-empty p {
  font-size: 15px;
  font-weight: 500;
  color: var(--muted);
}

.docs-empty-hint,
.history-empty-hint {
  font-size: 13px !important;
  font-weight: 400 !important;
  color: var(--faint) !important;
  max-width: 260px;
}

.history-item {
  padding: 12px 16px;
  border: 1px solid var(--border-light);
  border-radius: 10px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: all var(--transition);
  background: var(--surface);
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.history-item:hover {
  background: var(--bg-warm);
}

.history-item.active {
  border-color: rgba(13,148,136,0.4);
  background: var(--green-faint);
}

.history-item-content {
  flex: 1;
  min-width: 0;
}

.history-item-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-item-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  font-size: 12px;
  color: var(--faint);
}

.history-item-zone {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 8px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.history-item-zone.zone-green { background: var(--green-faint); color: var(--green); }
.history-item-zone.zone-amber { background: var(--amber-light); color: var(--amber); }
.history-item-zone.zone-red { background: var(--red-light); color: var(--red); }

.history-item-delete {
  width: 28px;
  height: 28px;
  border: none;
  background: none;
  color: var(--border);
  cursor: pointer;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  flex-shrink: 0;
  margin-top: 2px;
}

.history-item-delete:hover { background: var(--red-light); color: var(--red); }

.doc-card {
  padding: 16px;
  border: 1px solid var(--border-light);
  border-radius: 12px;
  margin-bottom: 8px;
  cursor: default;
  transition: all var(--transition);
  background: var(--surface);
}

.doc-card:hover { border-color: var(--border); box-shadow: var(--shadow-sm); }

.doc-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.doc-card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
  flex: 1;
}

.doc-card-zone {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  flex-shrink: 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.doc-card-zone.zone-green { background: var(--green-faint); color: var(--green); }
.doc-card-zone.zone-amber { background: var(--amber-light); color: var(--amber); }
.doc-card-zone.zone-red { background: var(--red-light); color: var(--red); }

.doc-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--faint);
  margin-bottom: 10px;
}

.doc-card-id {
  font-family: 'DM Sans', monospace;
  background: var(--bg-warm);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 11px;
}

.doc-card-notes {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 10px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.doc-card-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.doc-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
}

.doc-action-btn:hover {
  background: var(--green-faint);
  color: var(--green);
  border-color: var(--green);
}

.doc-action-btn.delete:hover {
  background: var(--red-light);
  color: var(--red);
  border-color: var(--red);
}

.docs-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.3);
  z-index: 199;
  animation: fadeIn 0.2s ease;
}

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

@keyframes dropdownFadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.notes-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.notes-action-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: none;
  color: var(--faint);
  cursor: pointer;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.notes-action-btn:hover { background: var(--bg-warm); color: var(--text); }

.notes-textarea {
  flex: 1;
  margin: 16px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  resize: none;
  outline: none;
  background: var(--bg);
  transition: border-color var(--transition);
}

.notes-textarea:focus {
  border-color: var(--green);
  background: var(--surface);
}

.notes-textarea::placeholder { color: var(--faint); }

.response-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
  animation: msgIn 0.3s ease forwards;
}

.option-pill {
  padding: 8px 16px;
  border-radius: 20px;
  border: 1.5px solid var(--green);
  background: var(--surface);
  color: var(--green);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.option-pill:hover {
  background: var(--green);
  color: white;
  transform: translateY(-1px);
  box-shadow: var(--shadow-hover);
}

.option-pill:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }
.option-pill.selected { background: var(--green); color: white; opacity: 0.7; cursor: default; transform: none; }
.response-options.collapsed .option-pill:not(.selected) { display: none; }

.template-download {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  animation: msgIn 0.3s ease forwards;
}

.download-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 8px;
  border: 1.5px solid var(--green);
  background: var(--surface);
  color: var(--green);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
}

.download-btn:hover {
  background: var(--green);
  color: white;
  transform: translateY(-1px);
  box-shadow: var(--shadow-hover);
}

.download-btn:disabled { opacity: 0.7; cursor: wait; transform: none; box-shadow: none; }

.download-btn-secondary { border-color: var(--faint); color: var(--muted); }
.download-btn-secondary:hover { background: var(--muted); color: white; border-color: var(--muted); }
.download-btn-save { border-color: var(--green); color: var(--green); }
.download-btn-save:hover { background: var(--green); color: white; }
.download-btn-saved { border-color: var(--green); color: var(--green); cursor: default; }
.download-btn-saved:hover { background: transparent; color: var(--green); border-color: var(--green); transform: none; box-shadow: none; }
.download-btn svg { flex-shrink: 0; }
.download-btn .spin { animation: spin 1s linear infinite; }

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

.tool-panel {
  position: fixed;
  top: 0;
  left: var(--sidebar-w);
  right: 0;
  bottom: 0;
  background: var(--surface);
  z-index: 50;
  display: flex;
  flex-direction: column;
  animation: fadeIn 0.15s ease;
}

.sidebar-collapsed ~ .tool-panel {
  left: var(--sidebar-collapsed);
}

.tool-panel.hidden { display: none; }

.tool-panel-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.tool-panel-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s ease;
}

.tool-panel-back-btn:hover {
  color: var(--text);
  border-color: var(--green);
  background: var(--green-light);
}

.tool-panel-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.tool-panel-frame {
  flex: 1;
  width: 100%;
  border: none;
  background: var(--bg);
}

.template-viewer {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  background: var(--surface);
  z-index: 300;
  display: flex;
  flex-direction: column;
  animation: fadeIn 0.15s ease;
}

.template-viewer.hidden { display: none; }

.template-viewer-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--primary);
  color: var(--white);
  flex-shrink: 0;
}

.template-viewer-title {
  font-size: 14px;
  font-weight: 500;
  opacity: 0.9;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  margin-right: 12px;
}

.template-viewer-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.template-viewer-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 6px;
  background: transparent;
  color: var(--white);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
}

.template-viewer-btn:hover { background: rgba(255,255,255,0.15); border-color: rgba(255,255,255,0.4); }
.template-viewer-close-btn { padding: 6px 8px; }

.template-viewer-frame {
  flex: 1;
  width: 100%;
  border: none;
  background: var(--surface);
}

.feedback-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 950;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.feedback-toggle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--green);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 12px rgba(13,148,136,0.2);
  transition: all 0.2s ease;
}

.feedback-toggle:hover { background: var(--green-mid); transform: scale(1.05); }

.feedback-panel {
  width: 320px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.1);
  overflow: hidden;
  animation: feedbackSlideIn 0.25s ease forwards;
}

@keyframes feedbackSlideIn {
  from { opacity: 0; transform: translateY(8px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.feedback-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-light);
}

.feedback-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.feedback-close {
  background: none;
  border: none;
  font-size: 20px;
  color: var(--faint);
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.feedback-close:hover { color: var(--text); }

.feedback-form-body { padding: 16px; }

.feedback-prompt {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 12px;
  text-align: center;
}

.feedback-ratings {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 14px;
}

.feedback-emoji {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 2px solid transparent;
  background: var(--bg);
  font-size: 20px;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.feedback-emoji:hover {
  background: var(--green-faint);
  border-color: var(--border);
  transform: scale(1.1);
}

.feedback-emoji.selected {
  border-color: var(--green);
  background: var(--green-faint);
  transform: scale(1.15);
}

.feedback-categories {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
  justify-content: center;
}

.feedback-cat {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  font-family: inherit;
  font-weight: 500;
  transition: all 0.15s;
}

.feedback-cat:hover { border-color: var(--border); background: var(--bg); }
.feedback-cat.selected { border-color: var(--green); background: var(--green-faint); color: var(--green); }

.feedback-message {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  resize: vertical;
  min-height: 60px;
  max-height: 120px;
  margin-bottom: 12px;
  outline: none;
  transition: border-color 0.15s;
}

.feedback-message::placeholder { color: var(--faint); }
.feedback-message:focus { border-color: var(--green); }

.feedback-submit {
  width: 100%;
  padding: 10px;
  border: none;
  border-radius: 10px;
  background: var(--green);
  color: white;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
}

.feedback-submit:hover:not(:disabled) { background: var(--green-mid); }
.feedback-submit:disabled { background: var(--border); cursor: not-allowed; }
.feedback-submit.sending { pointer-events: none; opacity: 0.7; }

.feedback-success {
  padding: 32px 16px;
  text-align: center;
}

.feedback-success-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--green-faint);
  color: var(--green);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 700;
  margin: 0 auto 12px;
}

.feedback-success p {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.feedback-success-sub {
  font-size: 12px;
  font-weight: 400 !important;
  color: var(--faint) !important;
  margin-top: 4px !important;
}

.msg-actions {
  display: flex;
  gap: 4px;
  margin-top: 8px;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.agent-message-wrapper:hover .msg-actions { opacity: 1; }

.msg-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border: none;
  background: var(--bg-warm);
  color: var(--muted);
  font-size: 12px;
  font-family: inherit;
  border-radius: 6px;
  cursor: pointer;
  transition: all var(--transition);
}

.msg-action-btn:hover { background: var(--border); color: var(--text); }
.msg-action-btn svg { flex-shrink: 0; }
.msg-action-btn.sent-feedback { color: var(--green); background: var(--green-faint); }

.checklist-download { margin-top: 10px; }

.docs-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--green);
  color: var(--white);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
}

@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    height: 100dvh;
    z-index: 100;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    width: var(--sidebar-w) !important;
  }

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

  .sidebar-collapsed.mobile-open {
    width: var(--sidebar-w) !important;
  }

  .mobile-menu-btn { display: flex; }
  .sidebar-collapse-btn { display: none; }
  .sidebar-expand-row { display: none !important; }

  .tool-panel,
  .sidebar-collapsed ~ .tool-panel {
    left: 0;
  }

  .mobile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.3);
    z-index: 99;
    animation: fadeIn 0.2s ease;
  }
}

@media (max-width: 480px) {
  .docs-panel,
  .history-panel,
  .notes-panel {
    width: 100vw;
  }

  .zone-tooltip {
    left: auto;
    right: -40px;
    transform: none;
    width: calc(100vw - 32px);
    max-width: 300px;
  }

  .top-bar { padding: 0 12px; gap: 8px; }
  .mode-pill { display: none; }

  .chat-container { padding: 16px 16px 80px; }
  .messages { max-width: 100%; }
  .agent-message { max-width: 95%; }
  .user-message { max-width: 92%; }
  .bottom-bar { padding: 12px 16px 12px; }
  .draft-watermark { font-size: 28px; }
  .starter-grid { grid-template-columns: 1fr; }
  .welcome-heading { font-size: 28px; }

  .feedback-widget { bottom: 16px; right: 16px; }
  .feedback-panel { width: 290px; }
  .feedback-toggle { width: 42px; height: 42px; }

  .progress-bar { padding: 8px 12px; }
  .progress-stage span { display: none; }
  .progress-stage.active span { display: inline; }
  .progress-connector { width: 16px; }

  .msg-actions { opacity: 1; }
}

@media (max-width: 600px) {
  .notes-panel { width: 100vw; }
}

.tc-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.tc-modal-overlay.hidden { display: none; }
.tc-modal {
  background: #fff;
  border-radius: 12px;
  max-width: 680px;
  width: 100%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.tc-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid #E2E8F0;
}
.tc-modal-header h2 {
  font-family: 'Playfair Display', serif;
  font-size: 1.25rem;
  color: #1E293B;
  margin: 0;
}
.tc-modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: #94A3B8;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}
.tc-modal-close:hover { color: #1E293B; }
.tc-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  font-size: 0.9rem;
  line-height: 1.65;
  color: #334155;
}
.tc-modal-body h1 {
  font-family: 'Playfair Display', serif;
  font-size: 1.4rem;
  color: #0D9488;
  margin: 0 0 4px;
  text-align: center;
}
.tc-modal-body h2 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #94A3B8;
  text-align: center;
  margin: 0 0 8px;
}
.tc-modal-body h3 {
  font-size: 0.8rem;
  color: #64748B;
  text-align: center;
  margin: 0 0 20px;
  font-weight: 400;
}
.tc-modal-body h4 {
  font-size: 1rem;
  color: #1E293B;
  margin: 24px 0 8px;
}
.tc-modal-body h5 {
  font-size: 0.95rem;
  color: #334155;
  margin: 16px 0 6px;
}
.tc-modal-body p { margin: 0 0 12px; }
.tc-modal-body ul {
  margin: 0 0 12px;
  padding-left: 24px;
}
.tc-modal-body li { margin-bottom: 4px; }
.tc-modal-footer {
  padding: 16px 24px 20px;
  border-top: 1px solid #E2E8F0;
}
.tc-checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.85rem;
  color: #334155;
  cursor: pointer;
  margin-bottom: 14px;
  line-height: 1.4;
}
.tc-checkbox-label input[type="checkbox"] {
  margin-top: 3px;
  accent-color: #0D9488;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
.tc-modal-footer .login-btn {
  width: 100%;
}
.tc-modal-footer .login-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
