/* ============================================================
   AI CFO PLATFORM — COMPLETE STYLESHEET
   File 02 of 13

   Structure:
   01. CSS Custom Properties (Design Tokens)
   02. Reset & Base
   03. Typography
   04. Screen System
   05. Logo & Brand
   06. Screen 1 — Sign In
   07. Screen 2 — Drive Connection
   08. Screen 3 — AI Activation
   09. Screen 4 — App Shell
   10. Sidebar
   11. Top Bar
   12. Center Panel & Empty State
   13. Chat Thread & Messages
   14. CFO Message Formatting
   15. Input Area
   16. Tier Wall
   17. Settings Modal
   18. Toast Notifications
   19. Buttons & Form Elements
   20. Animations & Transitions
   21. Scrollbars
   22. Responsive / Mobile
============================================================ */


/* ============================================================
   01. CSS CUSTOM PROPERTIES (DESIGN TOKENS)
============================================================ */

:root,
[data-theme="dark"] {
  /* Backgrounds */
  --bg-base:        #0f0f0f;
  --bg-sidebar:     #171717;
  --bg-panel:       #1e1e1e;
  --bg-elevated:    #252525;
  --bg-hover:       #2a2a2a;
  --bg-active:      #303030;
  --bg-input:       #1a1a1a;
  --bg-modal:       #1e1e1e;
  --bg-overlay:     rgba(0, 0, 0, 0.65);

  /* Borders */
  --border:         #2a2a2a;
  --border-light:   #222222;
  --border-focus:   #3b82f6;

  /* Text */
  --text-primary:   #e5e5e5;
  --text-secondary: #a3a3a3;
  --text-tertiary:  #6b6b6b;
  --text-inverse:   #0f0f0f;
  --text-link:      #60a5fa;

  /* Brand & Accents */
  --accent:         #2563eb;
  --accent-hover:   #1d4ed8;
  --accent-light:   #1e3a6e;
  --accent-glow:    rgba(37, 99, 235, 0.15);

  /* Semantic colours */
  --success:        #16a34a;
  --success-bg:     rgba(22, 163, 74, 0.12);
  --success-text:   #4ade80;
  --warning:        #d97706;
  --warning-bg:     rgba(217, 119, 6, 0.12);
  --warning-text:   #fbbf24;
  --critical:       #dc2626;
  --critical-bg:    rgba(220, 38, 38, 0.12);
  --critical-text:  #f87171;
  --medium-bg:      rgba(217, 119, 6, 0.1);
  --medium-text:    #fbbf24;

  /* Sidebar */
  --sidebar-width:  260px;

  /* Shadows */
  --shadow-sm:      0 1px 3px rgba(0,0,0,0.4);
  --shadow-md:      0 4px 12px rgba(0,0,0,0.5);
  --shadow-lg:      0 8px 32px rgba(0,0,0,0.6);
  --shadow-modal:   0 20px 60px rgba(0,0,0,0.7);

  /* Radius */
  --radius-sm:      6px;
  --radius-md:      10px;
  --radius-lg:      14px;
  --radius-xl:      20px;
  --radius-full:    9999px;

  /* Transitions */
  --transition:     150ms ease;
  --transition-md:  250ms ease;
}

[data-theme="light"] {
  --bg-base:        #ffffff;
  --bg-sidebar:     #f5f5f5;
  --bg-panel:       #fafafa;
  --bg-elevated:    #f0f0f0;
  --bg-hover:       #ebebeb;
  --bg-active:      #e5e5e5;
  --bg-input:       #ffffff;
  --bg-modal:       #ffffff;
  --bg-overlay:     rgba(0, 0, 0, 0.40);

  --border:         #e5e5e5;
  --border-light:   #efefef;
  --border-focus:   #2563eb;

  --text-primary:   #171717;
  --text-secondary: #525252;
  --text-tertiary:  #a3a3a3;
  --text-inverse:   #ffffff;
  --text-link:      #2563eb;

  --accent:         #2563eb;
  --accent-hover:   #1d4ed8;
  --accent-light:   #dbeafe;
  --accent-glow:    rgba(37, 99, 235, 0.08);

  --success:        #16a34a;
  --success-bg:     rgba(22, 163, 74, 0.08);
  --success-text:   #15803d;
  --warning:        #d97706;
  --warning-bg:     rgba(217, 119, 6, 0.08);
  --warning-text:   #b45309;
  --critical:       #dc2626;
  --critical-bg:    rgba(220, 38, 38, 0.08);
  --critical-text:  #b91c1c;
  --medium-bg:      rgba(217, 119, 6, 0.08);
  --medium-text:    #b45309;

  --shadow-sm:      0 1px 3px rgba(0,0,0,0.08);
  --shadow-md:      0 4px 12px rgba(0,0,0,0.10);
  --shadow-lg:      0 8px 32px rgba(0,0,0,0.12);
  --shadow-modal:   0 20px 60px rgba(0,0,0,0.15);
}


/* ============================================================
   02. RESET & BASE
============================================================ */

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

html {
  height: 100%;
  font-size: 14px;
  -webkit-text-size-adjust: 100%;
}

body {
  height: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--bg-base);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--text-link);
  text-decoration: none;
  transition: opacity var(--transition);
}
a:hover { opacity: 0.8; }

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
  font-size: inherit;
  line-height: inherit;
}

input, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

ul, ol { list-style: none; }

img { display: block; max-width: 100%; }

strong { font-weight: 600; }


/* ============================================================
   03. TYPOGRAPHY
============================================================ */

.mono {
  font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 13px;
}

.label-caps {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}


/* ============================================================
   04. SCREEN SYSTEM
   Only one screen is visible at a time.
   JS toggles .active class via app.js.
============================================================ */

.screen {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: none;
  opacity: 0;
  transition: opacity var(--transition-md);
}

.screen.active {
  display: flex;
  opacity: 1;
}

.screen--app {
  display: none; /* overridden below when active */
}
.screen--app.active {
  display: flex;
  flex-direction: row;
}


/* ============================================================
   05. LOGO & BRAND
============================================================ */

.logo-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: 10px;
  overflow: hidden;
}

.logo-mark--xs { width: 28px;  height: 28px; }
.logo-mark--sm { width: 36px;  height: 36px; }
.logo-mark    { width: 44px;  height: 44px; }
.logo-mark--xl { width: 60px;  height: 60px; }

.logo-mark svg { width: 100%; height: 100%; }

.logo-wordmark {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.logo-wordmark--sm {
  font-size: 15px;
}


/* ============================================================
   06. SCREEN 1 — SIGN IN
============================================================ */

.screen--signin {
  align-items: center;
  justify-content: center;
  background: var(--bg-base);
}

/* Subtle radial glow behind the card */
.signin-bg {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 80% 60% at 50% 40%, rgba(37,99,235,0.08) 0%, transparent 70%);
  pointer-events: none;
}

.signin-container {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  width: 100%;
  max-width: 420px;
  padding: 40px 32px;
  text-align: center;
}

.signin-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 40px;
}

.signin-tagline {
  font-size: 32px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.signin-descriptor {
  font-size: 15px;
  color: var(--text-secondary);
  margin-bottom: 36px;
  line-height: 1.5;
}

.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  height: 52px;
  border-radius: var(--radius-lg);
  background: var(--bg-panel);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 500;
  transition: background var(--transition), border-color var(--transition), box-shadow var(--transition);
  margin-bottom: 16px;
}

.btn-google:hover {
  background: var(--bg-hover);
  border-color: var(--border-focus);
  box-shadow: var(--shadow-sm);
}

.btn-google:active {
  background: var(--bg-active);
  transform: translateY(1px);
}

.btn-google__icon {
  flex-shrink: 0;
}

.signin-trust-note {
  font-size: 13px;
  color: var(--text-tertiary);
  margin-bottom: 40px;
}

.signin-features {
  display: flex;
  gap: 24px;
  justify-content: center;
}

.signin-feature {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.signin-feature__icon {
  font-size: 20px;
}

.signin-feature__text {
  font-size: 12px;
  color: var(--text-tertiary);
  font-weight: 500;
}


/* ============================================================
   07. SCREEN 2 — DRIVE CONNECTION
   (also shared base styles for Screen 3)
============================================================ */

.screen--drive,
.screen--activation {
  align-items: center;
  justify-content: center;
  background: var(--bg-base);
}

.onboarding-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 480px;
  padding: 40px 32px;
  text-align: center;
}

.onboarding-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 36px;
}

.onboarding-title {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.25;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.onboarding-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 32px;
}

.onboarding-note {
  font-size: 12px;
  color: var(--text-tertiary);
  line-height: 1.6;
  margin-top: 16px;
}

/* Drive explanation card */
.drive-card {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 20px;
  border-radius: var(--radius-lg);
  background: var(--bg-panel);
  border: 1px solid var(--border);
  text-align: left;
  margin-bottom: 28px;
  width: 100%;
}

.drive-card__icon {
  flex-shrink: 0;
  margin-top: 2px;
}

.drive-card__text {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.65;
}

.drive-card__text strong {
  color: var(--text-primary);
}

/* Trust badges */
.trust-badges {
  display: flex;
  gap: 20px;
  justify-content: center;
  margin-bottom: 32px;
}

.trust-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: var(--bg-panel);
  border: 1px solid var(--border);
  min-width: 80px;
}

.trust-badge__icon {
  font-size: 18px;
}

.trust-badge__label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}

/* Primary button (reused across onboarding) */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 48px;
  padding: 0 28px;
  border-radius: var(--radius-lg);
  background: var(--accent);
  color: #ffffff;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
  white-space: nowrap;
}

.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 4px 16px rgba(37,99,235,0.35);
}

.btn-primary:active {
  transform: translateY(1px);
}

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

.btn-drive-connect {
  width: 100%;
  max-width: 320px;
  height: 52px;
  font-size: 16px;
}


/* ============================================================
   08. SCREEN 3 — AI ACTIVATION
============================================================ */

/* Step list */
.activation-steps {
  display: flex;
  flex-direction: column;
  gap: 0;
  width: 100%;
  max-width: 380px;
  margin-top: 4px;
  margin-bottom: 32px;
}

.activation-step {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border-light);
  transition: opacity var(--transition-md);
}

.activation-step:last-child {
  border-bottom: none;
}

.activation-step--pending {
  opacity: 0.4;
}

.activation-step__indicator {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

/* Complete state */
.activation-step--complete .activation-step__indicator {
  background: var(--success-bg);
  color: var(--success-text);
  border: 1.5px solid var(--success);
}

/* Active state */
.activation-step--active .activation-step__indicator {
  background: var(--accent-light);
  border: 1.5px solid var(--accent);
}

/* Pending state */
.activation-step--pending .activation-step__indicator {
  background: var(--bg-panel);
  border: 1.5px solid var(--border);
}

.activation-step__body {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.activation-step__label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  text-align: left;
}

.activation-step--pending .activation-step__label {
  color: var(--text-tertiary);
}

.activation-step__detail {
  font-size: 12px;
  color: var(--text-tertiary);
  text-align: left;
}

/* Spinner for active step */
.step-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid var(--accent-light);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* Dot for pending step */
.step-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
}

/* Manual fallback panel */
.fallback-panel {
  width: 100%;
  max-width: 420px;
  margin-top: 8px;
}

.fallback-card {
  padding: 24px;
  border-radius: var(--radius-lg);
  background: var(--bg-panel);
  border: 1px solid var(--warning);
  text-align: left;
}

.fallback-card__header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.fallback-card__icon {
  font-size: 18px;
}

.fallback-card__title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.fallback-card__text {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 12px;
}

.fallback-card__link {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--accent);
  margin-bottom: 16px;
}

.fallback-input-row {
  display: flex;
  gap: 10px;
  align-items: stretch;
}

.input-field {
  flex: 1;
  height: 44px;
  padding: 0 14px;
  border-radius: var(--radius-md);
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-size: 13px;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.input-field:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.fallback-card__note {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 12px;
  line-height: 1.5;
}


/* ============================================================
   09. SCREEN 4 — APP SHELL
============================================================ */

.screen--app {
  display: flex;
  flex-direction: row;
  height: 100vh;
  overflow: hidden;
  background: var(--bg-base);
}


/* ============================================================
   10. SIDEBAR
============================================================ */

.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  max-width: var(--sidebar-width);
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  overflow: hidden;
  transition: width var(--transition-md), min-width var(--transition-md), transform var(--transition-md);
  z-index: 100;
  flex-shrink: 0;
}

/* Collapsed state (toggled by JS) */
.sidebar.sidebar--collapsed {
  width: 0;
  min-width: 0;
  overflow: hidden;
}

/* Header */
.sidebar__header {
  display: flex;
  align-items: center;
  height: 60px;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar__logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* New Chat button */
.sidebar__new-chat {
  padding: 12px 12px 8px;
  flex-shrink: 0;
}

.btn-new-chat {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 38px;
  border-radius: var(--radius-md);
  background: var(--bg-panel);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  transition: background var(--transition), border-color var(--transition);
}

.btn-new-chat:hover {
  background: var(--bg-hover);
  border-color: var(--accent);
  color: var(--accent);
}

/* History */
.sidebar__history {
  flex: 1;
  overflow-y: auto;
  padding: 8px 6px;
}

.history-group {
  margin-bottom: 4px;
}

.history-group__label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
  padding: 8px 10px 4px;
}

.history-group__list {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

/* Individual history item — injected by JS with this structure:
   <li class="history-item [history-item--active]" data-id="...">
     <button class="history-item__btn">
       <span class="history-item__title">...</span>
     </button>
     <button class="history-item__delete">...</button>
   </li>
*/
.history-item {
  display: flex;
  align-items: center;
  border-radius: var(--radius-sm);
  overflow: hidden;
  position: relative;
}

.history-item__btn {
  flex: 1;
  display: flex;
  align-items: center;
  text-align: left;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 400;
  overflow: hidden;
  transition: background var(--transition), color var(--transition);
  white-space: nowrap;
  min-width: 0;
}

.history-item__btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.history-item--active .history-item__btn {
  background: var(--bg-active);
  color: var(--text-primary);
  font-weight: 500;
}

.history-item__title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: block;
}

.history-item__delete {
  display: none;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  color: var(--text-tertiary);
  flex-shrink: 0;
  margin-right: 4px;
  transition: background var(--transition), color var(--transition);
}

.history-item:hover .history-item__delete {
  display: flex;
}

.history-item__delete:hover {
  background: var(--critical-bg);
  color: var(--critical-text);
}

/* Empty history message */
.history-empty {
  padding: 24px 16px;
  text-align: center;
}

.history-empty__text {
  font-size: 12px;
  color: var(--text-tertiary);
  line-height: 1.6;
}

/* Sidebar footer */
.sidebar__footer {
  border-top: 1px solid var(--border);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}

/* Drive connection status */
.drive-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
}

.drive-status__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.drive-status__dot--connected {
  background: var(--success);
  box-shadow: 0 0 0 2px var(--success-bg);
}

.drive-status__dot--disconnected {
  background: var(--critical);
  box-shadow: 0 0 0 2px var(--critical-bg);
}

.drive-status__dot--syncing {
  background: var(--warning);
  animation: pulse 1.5s ease-in-out infinite;
}

.drive-status__text {
  font-size: 12px;
  color: var(--text-tertiary);
}

/* User profile row */
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--transition);
}

.sidebar-user:hover {
  background: var(--bg-hover);
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #ffffff;
  flex-shrink: 0;
  overflow: hidden;
}

.user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.user-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Upgrade button */
.btn-upgrade {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  height: 36px;
  border-radius: var(--radius-md);
  background: var(--accent-light);
  border: 1px solid var(--accent);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  transition: background var(--transition), box-shadow var(--transition);
}

.btn-upgrade:hover {
  background: var(--accent);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(37,99,235,0.3);
}

/* Settings button */
.sidebar-settings-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  height: 34px;
  padding: 0 10px;
  border-radius: var(--radius-md);
  color: var(--text-tertiary);
  font-size: 12px;
  font-weight: 500;
  transition: background var(--transition), color var(--transition);
}

.sidebar-settings-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}


/* ============================================================
   11. TOP BAR
============================================================ */

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  padding: 0 16px 0 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-base);
  flex-shrink: 0;
  gap: 12px;
}

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

.topbar__right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

/* Sidebar toggle button */
.sidebar-toggle-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-tertiary);
  flex-shrink: 0;
  transition: background var(--transition), color var(--transition);
}

.sidebar-toggle-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* Editable chat title */
.chat-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  outline: none;
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  margin: 0 -8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 40px;
  max-width: 400px;
  cursor: text;
  transition: background var(--transition);
}

.chat-title:hover {
  background: var(--bg-hover);
}

.chat-title:focus {
  background: var(--bg-panel);
  outline: 1px solid var(--border-focus);
}

.chat-title:empty::before {
  content: attr(data-placeholder);
  color: var(--text-tertiary);
}

/* Sync status */
.topbar-sync {
  display: flex;
  align-items: center;
  gap: 6px;
}

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

.topbar-sync__dot--synced    { background: var(--success); }
.topbar-sync__dot--syncing   { background: var(--warning); animation: pulse 1.5s ease-in-out infinite; }
.topbar-sync__dot--error     { background: var(--critical); }

.topbar-sync__label {
  font-size: 12px;
  color: var(--text-tertiary);
}

/* Master Sheet info */
.topbar-sheet-info {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-tertiary);
}

.topbar-sheet-info__prefix {
  font-weight: 500;
}

.topbar-sheet-info__time {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
}

/* Icon button (topbar) */
.topbar-icon-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-tertiary);
  transition: background var(--transition), color var(--transition);
}

.topbar-icon-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}


/* ============================================================
   12. CENTER PANEL & EMPTY STATE
============================================================ */

.center-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* Empty state */
.empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 24px 24px;
  gap: 0;
  overflow-y: auto;
}

.empty-state__logo {
  margin-bottom: 20px;
}

.empty-state__title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.empty-state__subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 36px;
  text-align: center;
}

/* Starter prompts */
.starter-prompts {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: 560px;
}

.starter-prompt {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border-radius: var(--radius-lg);
  background: var(--bg-panel);
  border: 1px solid var(--border);
  text-align: left;
  transition: background var(--transition), border-color var(--transition), transform var(--transition);
  cursor: pointer;
}

.starter-prompt:hover {
  background: var(--bg-hover);
  border-color: var(--accent);
  transform: translateY(-1px);
}

.starter-prompt:active {
  transform: translateY(0);
}

.starter-prompt__icon {
  font-size: 20px;
  flex-shrink: 0;
}

.starter-prompt__body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.starter-prompt__title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.starter-prompt__desc {
  font-size: 12px;
  color: var(--text-secondary);
}


/* ============================================================
   13. CHAT THREAD & MESSAGES
============================================================ */

.chat-thread {
  flex: 1;
  overflow-y: auto;
  padding: 24px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  scroll-behavior: smooth;
}

/* Base message */
.msg {
  display: flex;
  gap: 12px;
  max-width: 100%;
  animation: fadeSlideIn 0.2s ease forwards;
}

/* CFO message — left aligned */
.msg--cfo {
  align-items: flex-start;
}

.msg__avatar {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--accent);
  overflow: hidden;
  margin-top: 2px;
}

.msg--cfo .msg__bubble {
  max-width: calc(100% - 44px);
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 0 var(--radius-lg) var(--radius-lg) var(--radius-lg);
  padding: 16px 18px;
}

/* Client message — right aligned */
.msg--client {
  flex-direction: row-reverse;
}

.msg--client .msg__bubble {
  max-width: 75%;
  background: var(--accent);
  border-radius: var(--radius-lg) 0 var(--radius-lg) var(--radius-lg);
  padding: 12px 16px;
}

.msg--client .msg__content {
  color: #ffffff;
  font-size: 14px;
  line-height: 1.6;
}

/* Message content */
.msg__content {
  font-size: 15px;
  line-height: 1.75;
  color: var(--text-primary);
  word-break: break-word;
}

/* Message footer */
.msg__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border-light);
}

.msg--client .msg__footer {
  border-top-color: rgba(255,255,255,0.2);
}

.msg__time {
  font-size: 11px;
  color: var(--text-tertiary);
  font-family: 'JetBrains Mono', monospace;
}

.msg--client .msg__time {
  color: rgba(255,255,255,0.6);
}

/* Message action buttons */
.msg__actions {
  display: flex;
  gap: 4px;
}

.msg-action-btn {
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-tertiary);
  font-size: 12px;
  transition: background var(--transition), color var(--transition);
}

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

/* File upload pill in chat */
.upload-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: var(--radius-full);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-secondary);
}

.upload-pill__icon { font-size: 16px; }
.upload-pill__name { font-weight: 500; color: var(--text-primary); }
.upload-pill__status { font-size: 11px; color: var(--warning-text); }

/* Typing indicator */
.msg--typing .msg__bubble {
  padding: 14px 18px;
}

.typing-dots {
  display: flex;
  align-items: center;
  gap: 5px;
  height: 16px;
}

.typing-dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-tertiary);
  animation: typingBounce 1.2s ease-in-out infinite;
}

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


/* ============================================================
   14. CFO MESSAGE FORMATTING
   The CFO's responses use structured sections.
   These styles render them with boardroom precision.
============================================================ */

/* Section headers within CFO messages */
.msg__content .cfo-section {
  margin-bottom: 16px;
}

.msg__content .cfo-section:last-child {
  margin-bottom: 0;
}

.msg__content .cfo-section-header {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  margin-bottom: 10px;
}

/* Section types */
.cfo-section-header--briefing   { background: var(--accent-light); color: var(--accent); border: 1px solid var(--accent); }
.cfo-section-header--analysis   { background: var(--bg-elevated); color: var(--text-secondary); border: 1px solid var(--border); }
.cfo-section-header--risk       { background: var(--critical-bg); color: var(--critical-text); border: 1px solid var(--critical); }
.cfo-section-header--recs       { background: var(--success-bg); color: var(--success-text); border: 1px solid var(--success); }
.cfo-section-header--actions    { background: var(--warning-bg); color: var(--warning-text); border: 1px solid var(--warning); }

/* Risk flags */
.risk-flag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.risk-flag--critical { background: var(--critical-bg); color: var(--critical-text); border: 1px solid var(--critical); }
.risk-flag--high     { background: var(--warning-bg);  color: var(--warning-text);  border: 1px solid var(--warning); }
.risk-flag--medium   { background: var(--medium-bg);   color: var(--medium-text);   border: 1px solid var(--warning); }

/* Numbers and financial values */
.msg__content .num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  font-weight: 600;
}

.msg__content .num--positive { color: var(--success-text); }
.msg__content .num--negative { color: var(--critical-text); }
.msg__content .num--neutral  { color: var(--warning-text); }

/* Priority actions list */
.msg__content .priority-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.msg__content .priority-action {
  display: flex;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
}

.msg__content .priority-action__rank {
  font-size: 13px;
  font-weight: 800;
  color: var(--accent);
  flex-shrink: 0;
  width: 20px;
}

.msg__content .priority-action__body {
  flex: 1;
}

.msg__content .priority-action__text {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.msg__content .priority-action__meta {
  font-size: 12px;
  color: var(--text-secondary);
}

/* Tables inside CFO messages */
.msg__content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin: 12px 0;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border);
}

.msg__content th {
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 9px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.msg__content td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-primary);
}

.msg__content tr:last-child td {
  border-bottom: none;
}

.msg__content tr:hover td {
  background: var(--bg-hover);
}

/* TD value types */
.msg__content td.val-good    { color: var(--success-text); font-family: 'JetBrains Mono', monospace; font-size: 12px; }
.msg__content td.val-bad     { color: var(--critical-text); font-family: 'JetBrains Mono', monospace; font-size: 12px; }
.msg__content td.val-watch   { color: var(--warning-text); font-family: 'JetBrains Mono', monospace; font-size: 12px; }

/* Paragraph spacing in CFO responses */
.msg__content p { margin-bottom: 10px; }
.msg__content p:last-child { margin-bottom: 0; }

.msg__content h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 14px 0 6px;
}

.msg__content ul, .msg__content ol {
  padding-left: 18px;
  margin-bottom: 10px;
}

.msg__content li {
  margin-bottom: 4px;
  font-size: 14px;
  line-height: 1.6;
  list-style: disc;
}

.msg__content ol li {
  list-style: decimal;
}

/* Horizontal divider between sections */
.msg__content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 14px 0;
}

/* Inline code / values */
.msg__content code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  color: var(--warning-text);
}


/* ============================================================
   15. INPUT AREA
============================================================ */

.input-area {
  padding: 12px 16px 14px;
  background: var(--bg-base);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* Upload progress bar */
.upload-progress {
  height: 3px;
  background: var(--border);
  border-radius: var(--radius-full);
  margin-bottom: 10px;
  overflow: hidden;
}

.upload-progress__bar {
  height: 100%;
  background: var(--accent);
  border-radius: var(--radius-full);
  width: 0%;
  transition: width 0.3s ease;
}

/* Attachment preview */
.attachment-preview {
  margin-bottom: 8px;
}

.attachment-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-primary);
}

.attachment-pill__icon { font-size: 15px; }
.attachment-pill__name { font-weight: 500; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.attachment-pill__remove {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  color: var(--text-tertiary);
  transition: background var(--transition), color var(--transition);
}

.attachment-pill__remove:hover {
  background: var(--critical-bg);
  color: var(--critical-text);
}

/* Input row */
.input-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 6px 6px 6px 8px;
  border-radius: var(--radius-xl);
  background: var(--bg-panel);
  border: 1px solid var(--border);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.input-row:focus-within {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

/* Icon buttons inside input row */
.input-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  color: var(--text-tertiary);
  flex-shrink: 0;
  transition: background var(--transition), color var(--transition);
}

.input-btn--upload:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.input-btn--send {
  background: var(--accent);
  color: #ffffff;
  border-radius: var(--radius-md);
  transition: background var(--transition), opacity var(--transition), transform var(--transition);
}

.input-btn--send:hover:not(:disabled) {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.input-btn--send:disabled {
  background: var(--bg-hover);
  color: var(--text-tertiary);
  cursor: not-allowed;
  transform: none;
}

/* Textarea wrapper */
.textarea-wrapper {
  flex: 1;
  min-width: 0;
}

.message-input {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  resize: none;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-primary);
  padding: 7px 4px;
  min-height: 36px;
  max-height: 200px;
  overflow-y: auto;
}

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

/* Privacy note */
.input-privacy-note {
  text-align: center;
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 8px;
  letter-spacing: 0.01em;
}


/* ============================================================
   16. TIER WALL
============================================================ */

.tier-wall {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-overlay);
  backdrop-filter: blur(4px);
  z-index: 50;
  padding: 24px;
}

.tier-wall__card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 40px 36px;
  max-width: 400px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow-lg);
}

.tier-wall__icon {
  font-size: 40px;
  margin-bottom: 16px;
}

.tier-wall__title {
  font-size: 19px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  margin-bottom: 12px;
}

.tier-wall__text {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.65;
  margin-bottom: 28px;
}

.btn-upgrade-cta {
  width: 100%;
  height: 50px;
  font-size: 15px;
  margin-bottom: 12px;
}

.tier-wall__footnote {
  font-size: 12px;
  color: var(--text-tertiary);
}


/* ============================================================
   17. SETTINGS MODAL
============================================================ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  padding: 20px;
  backdrop-filter: blur(2px);
  animation: fadeIn 0.15s ease forwards;
}

.modal {
  background: var(--bg-modal);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 480px;
  max-height: 85vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-modal);
  animation: slideUp 0.2s ease forwards;
}

.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.modal__title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.modal__close-btn {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-tertiary);
  transition: background var(--transition), color var(--transition);
}

.modal__close-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.modal__body {
  overflow-y: auto;
  padding: 8px 0;
}

/* Settings sections */
.settings-section {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border-light);
}

.settings-section:last-child {
  border-bottom: none;
}

.settings-section--danger {
  border-top: 1px solid var(--border);
}

.settings-section__title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 14px;
}

.settings-section__title--danger {
  color: var(--critical-text);
}

/* Settings row */
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 36px;
  margin-bottom: 10px;
}

.settings-row:last-child {
  margin-bottom: 0;
}

.settings-row__label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  flex: 1;
}

.settings-row__sublabel {
  display: block;
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 2px;
}

.settings-row__value {
  font-size: 13px;
  color: var(--text-secondary);
  font-family: 'JetBrains Mono', monospace;
}

.settings-row__value--green { color: var(--success-text); }

.settings-row__link {
  font-size: 13px;
  font-weight: 500;
  color: var(--accent);
}

/* Plan badge */
.settings-plan-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.settings-plan-badge--pro {
  background: var(--accent-light);
  color: var(--accent);
  border-color: var(--accent);
}

/* Theme switcher */
.theme-switcher {
  display: flex;
  gap: 4px;
  padding: 3px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.theme-btn {
  padding: 5px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: background var(--transition), color var(--transition);
}

.theme-btn--active {
  background: var(--bg-panel);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

/* Upgrade card inside settings */
.upgrade-card {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 16px;
  border-radius: var(--radius-lg);
  background: var(--accent-light);
  border: 1px solid var(--accent);
}

.upgrade-card__name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.upgrade-card__price {
  font-size: 22px;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: -0.03em;
  margin-bottom: 8px;
  font-family: 'JetBrains Mono', monospace;
}

.upgrade-card__features {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.upgrade-card__features li {
  font-size: 12px;
  color: var(--text-secondary);
  list-style: none;
  padding-left: 12px;
  position: relative;
}

.upgrade-card__features li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: var(--success-text);
  font-weight: 700;
}

.btn-upgrade-modal {
  flex-shrink: 0;
  white-space: nowrap;
  height: 44px;
}

/* Sign out button */
.btn-signout {
  padding: 7px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-signout:hover {
  background: var(--critical-bg);
  border-color: var(--critical);
  color: var(--critical-text);
}


/* ============================================================
   18. TOAST NOTIFICATIONS
============================================================ */

.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: var(--radius-lg);
  font-size: 13px;
  font-weight: 500;
  min-width: 260px;
  max-width: 380px;
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  animation: toastIn 0.25s ease forwards;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.toast--success {
  background: var(--success-bg);
  border-color: var(--success);
  color: var(--success-text);
}

.toast--warning {
  background: var(--warning-bg);
  border-color: var(--warning);
  color: var(--warning-text);
}

.toast--error {
  background: var(--critical-bg);
  border-color: var(--critical);
  color: var(--critical-text);
}

.toast__icon {
  font-size: 16px;
  flex-shrink: 0;
}

.toast__text {
  flex: 1;
  line-height: 1.4;
}

/* Dismissing toast */
.toast--dismissing {
  animation: toastOut 0.2s ease forwards;
}


/* ============================================================
   19. BUTTONS & FORM ELEMENTS
   (Additional standalone button styles)
============================================================ */

/* Secondary button */
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 18px;
  border-radius: var(--radius-md);
  background: var(--bg-panel);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  transition: background var(--transition), border-color var(--transition);
}

.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--border-focus);
}

/* Danger button */
.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 18px;
  border-radius: var(--radius-md);
  background: var(--critical-bg);
  border: 1px solid var(--critical);
  color: var(--critical-text);
  font-size: 13px;
  font-weight: 600;
  transition: background var(--transition);
}

.btn-danger:hover {
  background: var(--critical);
  color: #ffffff;
}

/* Focus visible — accessibility */
:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}


/* ============================================================
   20. ANIMATIONS & TRANSITIONS
============================================================ */

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

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30%           { transform: translateY(-5px); opacity: 1; }
}

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

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

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(20px); }
}

/* Step completion animation */
@keyframes stepComplete {
  0%   { transform: scale(0.8); opacity: 0; }
  60%  { transform: scale(1.15); }
  100% { transform: scale(1); opacity: 1; }
}

.activation-step--complete .step-check {
  animation: stepComplete 0.4s ease forwards;
}


/* ============================================================
   21. SCROLLBARS
============================================================ */

/* Webkit scrollbars — subtle and consistent */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--bg-hover);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--bg-active);
}

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--bg-hover) transparent;
}


/* ============================================================
   22. RESPONSIVE / MOBILE
============================================================ */

@media (max-width: 768px) {

  :root {
    --sidebar-width: 280px;
  }

  /* On mobile, sidebar overlays rather than pushing content */
  .screen--app {
    position: relative;
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 200;
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
    transition: transform var(--transition-md);
  }

  .sidebar.sidebar--collapsed {
    transform: translateX(-100%);
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
  }

  /* Overlay behind open sidebar on mobile */
  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: var(--bg-overlay);
    z-index: 190;
  }

  .sidebar-overlay.active {
    display: block;
  }

  /* Full-width main on mobile */
  .main {
    width: 100%;
  }

  /* Topbar adjustments */
  .topbar-sheet-info { display: none; }
  .topbar-sync { display: none; }

  /* Starter prompts stack */
  .starter-prompts { gap: 8px; }
  .starter-prompt { padding: 12px 14px; }

  /* Smaller sign-in */
  .signin-tagline { font-size: 26px; }

  /* Chat messages */
  .msg--client .msg__bubble { max-width: 90%; }

  /* Toast */
  .toast-container {
    bottom: 16px;
    right: 16px;
    left: 16px;
  }

  .toast {
    min-width: unset;
    max-width: 100%;
  }

  /* Modal */
  .modal {
    max-height: 90vh;
    margin: 0 8px;
  }
}

@media (max-width: 480px) {
  .signin-tagline { font-size: 22px; }
  .signin-features { gap: 12px; }
  .signin-container { padding: 32px 20px; }
  .onboarding-container { padding: 32px 20px; }
  .trust-badges { gap: 10px; }
  .trust-badge { padding: 10px 12px; min-width: 70px; }
  .empty-state__title { font-size: 18px; }
  .empty-state { padding: 24px 16px 16px; }
}

/* ============================================================
   END OF STYLESHEET
============================================================ */
