/* ============================================
   SCRYBE — Design System (Vercel-inspired)
   Single CSS file: tokens + base + components + utilities
   Version: 1.1.0 — refactored: merged duplicate @media, added missing tokens
   ============================================ */

/* ──────────────────────────────────────────────
   DESIGN TOKENS — Vercel-inspired
   ────────────────────────────────────────────── */
:root {
  /* ─── Colors (Linear-стиль из прототипа) ─── */
  --color-bg: #f7f7f8;                         /* Page background */
  --color-bg-secondary: #ffffff;               /* Secondary backgrounds, sidebar hover */
  --color-bg-subtle: #f1f1f2;                  /* Subtle bg (table headers, etc.) */
  --color-bg-hover: #e9e9ec;                   /* Hover state for interactive backgrounds */
  --color-surface: #ffffff;                    /* Card/surface bg */
  --color-surface-hover: #e9e9ec;              /* Card hover state */
  --color-border: #e4e4e7;                     /* Subtle border via shadow */
  --color-border-strong: #d4d4d8;              /* Stronger border for active states */
  --color-border-light: #efeff1;               /* Lighter border variant */

  --color-text: #18181b;                       /* Primary text */
  --color-text-secondary: #52525b;             /* Meta/secondary text */
  --color-text-tertiary: #a1a1aa;              /* Placeholder/subtle text */
  --color-text-inverse: #ffffff;               /* White text on dark accent bg */

  --color-accent: #5b6bf0;                     /* Accent (buttons) */
  --color-accent-hover: #4a5ae8;               /* Accent hover */
  --color-accent-bg: rgba(91, 107, 240, 0.10); /* Accent bg (sidebar active, etc.) */
  --color-accent-subtle: rgba(91, 107, 240, 0.10); /* Subtle accent bg (filter chips, etc.) */
  --color-accent-border: rgba(91, 107, 240, 0.35); /* Accent border (filter active state) */
  --color-link: #5b6bf0;                       /* Link/action */
  --color-link-hover: #4a5ae8;                 /* Link hover */
  --color-link-alpha: rgba(91, 107, 240, 0.2); /* Link focus ring */

  /* ─── Workflow Colors ─── */
  --color-develop: #2563eb;                    /* Develop / info */
  --color-preview: #ea580c;                    /* Preview / warning / medium */
  --color-ship: #ff5b4f;                       /* Ship / danger / high */
  --color-dev-bg: rgba(10, 114, 239, 0.10);   /* Develop bg */
  --color-preview-bg: rgba(222, 29, 141, 0.10); /* Preview bg */
  --color-ship-bg: rgba(255, 91, 79, 0.10);   /* Ship bg */

  /* ─── Semantic Colors ─── */
  --color-success: #16a34a;                    /* Success / positive */
  --color-success-subtle: #e3f5ec;             /* Success bg */
  --color-danger: #dc2626;                     /* Danger / error */
  --color-danger-subtle: #fce9e7;              /* Danger bg */
  --color-warning: #d97706;                    /* Warning / caution */
  --color-warning-subtle: #fef0db;             /* Warning bg */
  --color-info: #3861d9;                       /* Info */
  --color-info-subtle: #e6edfe;                /* Info bg */

  /* ─── Mark Highlight ─── */
  --color-mark-bg: #fef3c7;
  --color-mark-text: #92400e;

  /* ─── Skeleton ─── */
  --color-skeleton: #e9e9ec;
  --color-skeleton-shine: #e0e0e4;

  /* ─── Shadows (shadow-as-border technique) ─── */
  --shadow-border: 0px 0px 0px 1px #e4e4e7;
  --shadow-border-hover: 0px 0px 0px 1px #d4d4d8;
  --shadow-card: 0px 0px 0px 1px #e4e4e7,
                 0px 2px 2px rgba(0, 0, 0, 0.04),
                 #f7f7f8 0px 0px 0px 1px;
  --shadow-card-hover: 0px 0px 0px 1px #d4d4d8,
                       0px 4px 8px rgba(0, 0, 0, 0.06),
                       #f7f7f8 0px 0px 0px 1px;
  --shadow-button: 0px 0px 0px 1px #e4e4e7;
  --shadow-button-hover: 0px 0px 0px 1px #d4d4d8,
                         0px 2px 4px rgba(0, 0, 0, 0.06);
  --shadow-button-primary: 0px 0px 0px 1px #e4e4e7,
                           0px 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-button-primary-hover: 0px 0px 0px 1px #d4d4d8,
                                 0px 2px 4px rgba(0, 0, 0, 0.08);

  /* ─── Typography ─── */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;

  --font-size-xs: 0.75rem;    /* 12px */
  --font-size-sm: 0.8125rem;  /* 13px */
  --font-size-base: 0.875rem; /* 14px */
  --font-size-lg: 1rem;       /* 16px */
  --font-size-xl: 1.125rem;   /* 18px */
  --font-size-2xl: 1.5rem;    /* 24px */
  --font-size-3xl: 2rem;      /* 32px */

  /* ─── Spacing (4px base) ─── */
  --space-1: 0.25rem;   /* 4px */
  --space-2: 0.5rem;    /* 8px */
  --space-3: 0.75rem;   /* 12px */
  --space-4: 1rem;      /* 16px */
  --space-5: 1.25rem;   /* 20px */
  --space-6: 1.5rem;    /* 24px */
  --space-8: 2rem;      /* 32px */
  --space-10: 2.5rem;   /* 40px */
  --space-12: 3rem;     /* 48px */

  /* ─── Border Radius ─── */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-pill: 9999px;

  /* ─── Layout ─── */
  --sidebar-width: 200px;
  --sidebar-collapsed: 60px;
  --content-max-width: 1280px;

  /* ─── Simple Shadows (elevation) ─── */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.03), 0 1px 1px rgba(0, 0, 0, 0.02);
  --shadow-md: 0 2px 4px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.05), 0 2px 6px rgba(0, 0, 0, 0.04);

  /* ─── Chat Widget ─── */
  --chat-user-bg: var(--color-accent);
  --chat-user-text: var(--color-text-inverse);
  --chat-bot-bg: var(--color-surface);
  --chat-bot-text: var(--color-text);
  --shadow-widget: 0 8px 32px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.06);

  /* ─── Motion ─── */
  --transition-fast: 150ms cubic-bezier(.16, 1, .3, 1);
  --transition-base: 250ms cubic-bezier(.16, 1, .3, 1);
  color-scheme: light;
}

[data-theme="dark"] {
  color-scheme: dark;
  --color-bg: #121212;
  --color-bg-secondary: #1a1a1a;
  --color-bg-subtle: #1e1e1e;
  --color-bg-hover: #232323;
  --color-surface: #1a1a1a;
  --color-surface-hover: #232323;
  --color-border: #262626;
  --color-border-strong: #333333;
  --color-border-light: #1e1e1e;

  --color-text: #e8e8e8;
  --color-text-secondary: #9a9a9a;
  --color-text-tertiary: #666666;
  --color-text-inverse: #ffffff;

  --color-accent: #7c8cf8;
  --color-accent-hover: #8d9bf9;
  --color-accent-bg: rgba(124, 140, 248, 0.12);
  --color-accent-subtle: rgba(124, 140, 248, 0.12);
  --color-accent-border: rgba(124, 140, 248, 0.35);
  --color-link: #8d9bf9;
  --color-link-hover: #a5b1fb;
  --color-link-alpha: rgba(124, 140, 248, 0.2);

  --color-develop: #60a5fa;
  --color-preview: #fb923c;
  --color-ship: #ff5b4f;
  --color-dev-bg: rgba(96, 165, 250, 0.14);
  --color-preview-bg: rgba(251, 146, 60, 0.14);
  --color-ship-bg: rgba(255, 91, 79, 0.14);

  --color-success: #4ade80;
  --color-success-subtle: #0a2e1f;
  --color-danger: #f87171;
  --color-danger-subtle: #301a17;
  --color-warning: #fbbf24;
  --color-warning-subtle: #302614;
  --color-info: #60a5fa;
  --color-info-subtle: #141f38;

  --color-mark-bg: #fbbf24;
  --color-mark-text: #121212;

  --color-skeleton: #1e1e1e;
  --color-skeleton-shine: #232323;

  --shadow-border: 0px 0px 0px 1px #262626;
  --shadow-border-hover: 0px 0px 0px 1px #333333;
  --shadow-card: 0px 0px 0px 1px #262626,
                 0px 2px 2px rgba(0, 0, 0, 0.25),
                 #1a1a1a 0px 0px 0px 1px;
  --shadow-card-hover: 0px 0px 0px 1px #333333,
                       0px 4px 8px rgba(0, 0, 0, 0.3),
                       #1a1a1a 0px 0px 0px 1px;
  --shadow-button: 0px 0px 0px 1px #262626;
  --shadow-button-hover: 0px 0px 0px 1px #333333,
                         0px 2px 4px rgba(0, 0, 0, 0.3);
  --shadow-button-primary: 0px 0px 0px 1px #262626,
                           0px 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-button-primary-hover: 0px 0px 0px 1px #333333,
                                 0px 2px 4px rgba(0, 0, 0, 0.35);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2), 0 1px 1px rgba(0, 0, 0, 0.15);
  --shadow-md: 0 2px 4px rgba(0, 0, 0, 0.25), 0 1px 3px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.3), 0 2px 6px rgba(0, 0, 0, 0.2);

  --shadow-widget: 0 8px 32px rgba(0, 0, 0, 0.4), 0 2px 8px rgba(0, 0, 0, 0.2);

  --transition-fast: 150ms cubic-bezier(.16, 1, .3, 1);
  --transition-base: 250ms cubic-bezier(.16, 1, .3, 1);
}



/* ──────────────────────────────────────────────
   RESET & BASE
   ────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

body {
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
  height: 100vh;
}

a {
  color: var(--color-link);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover {
  color: var(--color-link-hover);
  text-decoration: underline;
}

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

button {
  font-family: inherit;
  cursor: pointer;
}

/* Remove default list styles */
ul, ol {
  list-style: none;
}

/* ──────────────────────────────────────────────
   UTILITY CLASSES
   ────────────────────────────────────────────── */
.text-secondary { color: var(--color-text-secondary); }
.text-tertiary { color: var(--color-text-tertiary); }
.text-sm { font-size: var(--font-size-sm); }
.text-xs { font-size: var(--font-size-xs); }

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
}

.grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: var(--space-4);
}

.truncate {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ──────────────────────────────────────────────
   SKELETON LOADING
   ────────────────────────────────────────────── */
@keyframes skeleton-pulse {
  0% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.skeleton {
  background: linear-gradient(
    90deg,
    var(--color-skeleton) 25%,
    var(--color-skeleton-shine) 50%,
    var(--color-skeleton) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-pulse 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
  color: transparent !important;
  user-select: none;
  pointer-events: none;
}

.skeleton-text {
  display: inline-block;
  height: 14px;
  width: 80%;
  margin-bottom: 4px;
}

.skeleton-block {
  display: block;
  height: 16px;
  width: 100%;
  margin-bottom: var(--space-2);
}

.skeleton-stat {
  height: 80px;
  width: 100%;
  border-radius: var(--radius-md);
}

.skeleton-row {
  height: 48px;
  width: 100%;
  border-radius: var(--radius-sm);
  margin-bottom: 4px;
}

/* ──────────────────────────────────────────────
   APP LAYOUT
   ────────────────────────────────────────────── */
.app-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

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

/* ──────────────────────────────────────────────
   SIDEBAR
   ────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  height: 100vh;
  background: var(--color-bg);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow-y: auto;
  box-shadow: var(--shadow-border);
  z-index: 10;
  transition: width 0.2s ease, min-width 0.2s ease;
}

.sidebar-logo {
  padding: var(--space-4) var(--space-4) var(--space-5);
}

.sidebar-logo-link {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.03em;
  color: var(--color-text);
  text-decoration: none;
}

.sidebar-logo-icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  color: var(--color-accent);
  filter: drop-shadow(0 0 6px color-mix(in srgb, var(--color-accent) 30%, transparent));
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 var(--space-2);
  flex: 1;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 9px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 400;
  color: var(--color-text-secondary);
  transition: all 0.15s ease;
  user-select: none;
  position: relative;
}

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

.sidebar-item.active {
  color: var(--color-text);
  font-weight: 500;
  background: var(--color-bg-secondary);
}

.sidebar-item-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  line-height: 1;
}

.sidebar-item-icon svg {
  width: 15px;
  height: 15px;
  stroke-width: 1.7;
}

.sidebar-item.active .sidebar-item-icon {
  color: var(--color-text);
}

.sidebar-item-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-divider {
  height: 1px;
  background: var(--color-border);
  margin: var(--space-2) var(--space-4);
}

.sidebar-section-label {
  padding: var(--space-2) var(--space-4) var(--space-1);
  font-size: 11px;
  font-weight: 500;
  color: var(--color-text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* Hamburger button — mobile topbar */
.hamburger {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  color: var(--color-text);
  background: none;
  border: 1px solid transparent;
  flex-shrink: 0;
  transition: background 0.15s ease, border-color 0.15s ease;
}

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

.hamburger-icon,
.hamburger-icon::before,
.hamburger-icon::after {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 1px;
  background: currentColor;
  position: relative;
}

.hamburger-icon::before,
.hamburger-icon::after {
  content: "";
  position: absolute;
  left: 0;
}

.hamburger-icon::before {
  top: -6px;
}

.hamburger-icon::after {
  top: 6px;
}

/* Mobile top bar */
.mobile-topbar {
  display: none;
}

.sidebar-backdrop {
  display: none;
}

/* ──────────────────────────────────────────────
   SIDEBAR FOOTER
   ────────────────────────────────────────────── */
.sidebar-footer {
  margin-top: auto;
}

.sidebar-footer .sidebar-divider {
  margin: var(--space-1) var(--space-2) var(--space-2);
}

.sidebar-footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-2) var(--space-3);
  gap: var(--space-1);
}

.sidebar-footer-left {
  display: flex;
  align-items: center;
  min-width: 0;
  flex: 1;
}

.sidebar-footer-right {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

/* User info in sidebar footer */
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
  position: relative;
}

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

.user-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--color-text);
  font-size: var(--font-size-sm);
  flex: 1;
  min-width: 0;
}

/* User popover */
.user-popover {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card-hover);
  padding: var(--space-3) var(--space-4);
  min-width: 160px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
}

.user-popover-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--color-accent);
  color: var(--color-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
}

.user-popover-name {
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-text);
  text-align: center;
  white-space: nowrap;
}

.user-popover-logout {
  display: block;
  width: 100%;
  text-align: center;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  text-decoration: none;
  transition: all 0.15s ease;
}

.user-popover-logout:hover {
  background: var(--color-bg-secondary);
  color: var(--color-danger);
}

/* Theme Toggle */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--color-text-secondary);
  font-size: 16px;
  background: none;
  border: none;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.theme-toggle:hover {
  color: var(--color-text);
  background: var(--color-bg-hover);
}

/* Settings icon in sidebar footer */
.sidebar-footer-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--color-text-secondary);
  font-size: 16px;
  transition: all 0.15s ease;
  flex-shrink: 0;
  text-decoration: none;
}

.sidebar-footer-icon:hover {
  color: var(--color-text);
  background: var(--color-bg-hover);
}

.sidebar-footer-icon.active {
  color: var(--color-text);
  background: var(--color-bg-secondary);
}

.sidebar-footer-icon svg {
  width: 15px;
  height: 15px;
  stroke-width: 1.7;
}

.theme-toggle svg {
  width: 14px;
  height: 14px;
  stroke-width: 1.7;
}

/* ──────────────────────────────────────────────
   PAGE CONTENT
   ────────────────────────────────────────────── */
.page-content {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-8);
  background: var(--color-bg);
}

.page-content-inner {
  max-width: var(--content-max-width);
  margin: 0 auto;
  width: 100%;
}

.page-section {
  display: none;
}

.page-section.active {
  display: block;
}

/* Section header */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}

.section-title {
  font-size: var(--font-size-lg);
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--color-text);
}

.section-action {
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-link);
  cursor: pointer;
  transition: color 0.15s ease;
}

.section-action:hover {
  text-decoration: underline;
}

/* ── Inline title editing ── */

.section-title-group {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.section-title-group .section-title {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
}

.section-title-group .section-title:hover .btn-edit-icon {
  opacity: 1;
}

.btn-edit-icon {
  opacity: 0;
  transition: opacity 0.15s;
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  line-height: 1;
  color: var(--color-text-tertiary);
}
.btn-edit-icon:hover {
  background: var(--color-bg-hover);
  color: var(--color-text);
}

.title-edit-group {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.title-input {
  font-size: var(--font-size-lg);
  font-weight: 500;
  letter-spacing: -0.02em;
  padding: 4px 8px;
  border: 1px solid var(--color-accent);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
  outline: none;
  min-width: 300px;
  max-width: 100%;
}
.title-input:focus {
  box-shadow: 0 0 0 2px var(--color-accent-bg);
}

.title-save-indicator {
  font-size: var(--font-size-xs);
  color: var(--color-text-tertiary);
}

/* ──────────────────────────────────────────────
   STAT CARDS (KPI Metrics)
   ────────────────────────────────────────────── */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-8);
}

.stat-card {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  padding: var(--space-5) var(--space-6);
  box-shadow: var(--shadow-card);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
  cursor: default;
}

.stat-card:hover {
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-1px);
}

.stat-card-label {
  font-size: var(--font-size-sm);
  font-weight: 400;
  color: var(--color-text-tertiary);
  margin-bottom: 6px;
  letter-spacing: -0.01em;
}

.stat-card-value {
  font-size: var(--font-size-3xl);
  font-weight: 600;
  letter-spacing: -0.04em;
  color: var(--color-text);
  line-height: 1.1;
}

.stat-card-change {
  font-size: var(--font-size-xs);
  font-weight: 500;
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.stat-card-change.up {
  color: var(--color-develop);
}

.stat-card-change.down {
  color: var(--color-ship);
}

.stat-card-subtitle {
  font-size: var(--font-size-xs);
  font-weight: 400;
  color: var(--color-text-tertiary);
  margin-top: 4px;
  line-height: 1.2;
}

/* ──────────────────────────────────────────────
   BADGES & STATUS
   ────────────────────────────────────────────── */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.status-badge.completed {
  background: var(--color-dev-bg);
  color: var(--color-develop);
}

.status-badge.in-progress {
  background: var(--color-preview-bg);
  color: var(--color-preview);
}

.status-badge.scheduled {
  background: var(--color-accent-bg);
  color: var(--color-text-secondary);
}

.status-badge.cancelled {
  background: var(--color-ship-bg);
  color: var(--color-ship);
}

.status-badge.open {
  background: var(--color-accent-bg);
  color: var(--color-text-secondary);
  border: 1px solid var(--color-border);
}

.status-badge.done {
  background: var(--color-dev-bg);
  color: var(--color-develop);
}

.status-badge.failed {
  background: var(--color-ship-bg);
  color: var(--color-ship);
}

/* Priority dots */
.priority-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.priority-dot.high {
  background: var(--color-ship);
}

.priority-dot.medium {
  background: var(--color-preview);
}

.priority-dot.low {
  background: var(--color-develop);
}

/* ──────────────────────────────────────────────
   BUTTONS
   ────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 7px 16px;
  border-radius: var(--radius-sm);
  font-size: var(--font-size-base);
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  border: none;
  font-family: inherit;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-primary {
  background: var(--color-accent);
  color: var(--color-bg);
  box-shadow: var(--shadow-button-primary);
}

.btn-primary:hover {
  background: var(--color-accent-hover);
  box-shadow: var(--shadow-button-primary-hover);
}

.btn-secondary {
  background: var(--color-surface);
  color: var(--color-text);
  box-shadow: var(--shadow-button);
}

.btn-secondary:hover {
  box-shadow: var(--shadow-button-hover);
  background: var(--color-bg-secondary);
}

.btn-ghost {
  background: transparent;
  color: var(--color-text-secondary);
  box-shadow: none;
}

.btn-ghost:hover {
  color: var(--color-text);
  background: var(--color-bg-secondary);
}

.btn-link {
  background: transparent;
  color: var(--color-link);
  box-shadow: none;
  padding: 4px 8px;
}

.btn-link:hover {
  color: var(--color-link-hover);
  text-decoration: underline;
}

.btn-sm {
  padding: 4px 10px;
  font-size: var(--font-size-sm);
}

.btn-xs {
  padding: 2px 8px;
  font-size: var(--font-size-xs);
}

.btn-icon {
  padding: 6px;
  min-width: 32px;
  min-height: 32px;
}

.btn-loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}

.btn-loading::after {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: btn-spin 0.6s linear infinite;
}

.btn-primary.btn-loading::after {
  border-color: rgba(255, 255, 255, 0.6);
  border-right-color: transparent;
}

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

/* ──────────────────────────────────────────────
   FILTER BAR (Pill-style)
   ────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-6);
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  font-size: var(--font-size-sm);
  font-weight: 400;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  box-shadow: var(--shadow-button);
  background: var(--color-surface);
}

.filter-chip:hover {
  box-shadow: var(--shadow-button-hover);
  color: var(--color-text);
  text-decoration: none;
}

.filter-chip.active {
  box-shadow: 0px 0px 0px 1px var(--color-accent);
  color: var(--color-text);
  font-weight: 500;
  background: var(--color-accent-bg);
}

.filter-chip .chip-count {
  margin-left: 6px;
  font-size: 11px;
  color: var(--color-text-tertiary);
  font-weight: 400;
}

/* ──────────────────────────────────────────────
   TABLE (Clean, no vertical borders)
   ────────────────────────────────────────────── */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
}

.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--color-surface);
}

.table thead {
  background: var(--color-bg-secondary);
}

.table th {
  padding: 12px 20px;
  font-size: 11px;
  font-weight: 500;
  color: var(--color-text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-align: left;
  white-space: nowrap;
}

.table td {
  padding: 14px 20px;
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  border-top: 1px solid var(--color-border);
}

.table tbody tr {
  cursor: pointer;
  transition: box-shadow 0.15s ease, background 0.15s ease;
}

.table tbody tr:hover {
  background: var(--color-bg-secondary);
  box-shadow: var(--shadow-card-hover);
  position: relative;
  z-index: 1;
}

.table tbody tr:first-child td {
  border-top: none;
}

/* Meeting list (non-table rows) */
.meeting-list {
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.meeting-row {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: 14px var(--space-4);
  cursor: pointer;
  transition: box-shadow 0.15s ease, background 0.15s ease;
  box-shadow: 0px -1px 0px 0px var(--color-border);
  background: var(--color-surface);
}

.meeting-row:first-child {
  box-shadow: none;
}

.meeting-row:hover {
  box-shadow: var(--shadow-card-hover);
  position: relative;
  z-index: 1;
  background: var(--color-bg-secondary);
}

.meeting-emoji {
  font-size: 20px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-accent-bg);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.meeting-info {
  flex: 1;
  min-width: 0;
}

.meeting-title {
  font-size: var(--font-size-base);
  font-weight: 500;
  color: var(--color-text);
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.meeting-meta {
  font-size: var(--font-size-xs);
  color: var(--color-text-tertiary);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: 2px;
}

.meeting-meta-sep {
  color: var(--color-border);
}

.meeting-status {
  flex-shrink: 0;
}

/* ──────────────────────────────────────────────
   GRID TABLE (Meeting List Table)
   ────────────────────────────────────────────── */
.meeting-table {
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.meeting-table-header {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr 80px;
  gap: var(--space-4);
  padding: 12px 20px;
  font-size: 11px;
  font-weight: 500;
  color: var(--color-text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--color-bg-secondary);
}

.meeting-table-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr 80px;
  gap: var(--space-4);
  padding: 14px 20px;
  align-items: center;
  background: var(--color-surface);
  cursor: pointer;
  transition: box-shadow 0.15s ease;
  box-shadow: 0px -1px 0px 0px var(--color-border);
}

.meeting-table-row:hover {
  box-shadow: var(--shadow-card-hover);
  position: relative;
  z-index: 1;
}

.meeting-table-title {
  font-size: var(--font-size-base);
  font-weight: 500;
  color: var(--color-text);
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.meeting-table-title .meeting-table-emoji {
  font-size: 16px;
  flex-shrink: 0;
}

.meeting-table-cell {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
}

.meeting-table-priority {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--font-size-xs);
  font-weight: 500;
}

.meeting-table-priority.high { color: var(--color-ship); }
.meeting-table-priority.medium { color: var(--color-preview); }
.meeting-table-priority.low { color: var(--color-develop); }

/* Responsive table classes */
.hide-tablet { display: inline; }
.hide-mobile { display: inline; }

/* ──────────────────────────────────────────────
   PAGINATION
   ────────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-top: var(--space-6);
}

.pagination-item {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  font-size: var(--font-size-sm);
  font-weight: 400;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.pagination-item:hover {
  color: var(--color-text);
  background: var(--color-bg-secondary);
}

.pagination-item.active {
  color: var(--color-text);
  font-weight: 500;
  background: var(--color-accent-bg);
  box-shadow: var(--shadow-border);
}

.pagination-item.arrow {
  font-size: 15px;
}

.pagination-item.disabled {
  opacity: 0.3;
  cursor: default;
  pointer-events: none;
}

/* ──────────────────────────────────────────────
   EMPTY STATE
   ────────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
}

.empty-state-icon {
  font-size: 40px;
  margin-bottom: var(--space-4);
  opacity: 0.4;
}

.empty-state-title {
  font-size: var(--font-size-lg);
  font-weight: 500;
  color: var(--color-text);
  margin-bottom: 6px;
  letter-spacing: -0.02em;
}

.empty-state-desc {
  font-size: var(--font-size-sm);
  color: var(--color-text-tertiary);
  max-width: 300px;
  line-height: 1.5;
}

.empty-state-action {
  margin-top: var(--space-4);
}

/* ──────────────────────────────────────────────
   TOAST NOTIFICATIONS
   ────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  pointer-events: none;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes toast-out {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateY(-8px) scale(0.96);
  }
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: var(--color-surface);
  box-shadow: 0px 0px 0px 1px var(--color-border),
              0px 8px 24px rgba(0, 0, 0, 0.12);
  font-size: var(--font-size-sm);
  color: var(--color-text);
  animation: toast-in 0.25s ease forwards;
  pointer-events: auto;
  min-width: 280px;
  max-width: 400px;
}

.toast.removing {
  animation: toast-out 0.2s ease forwards;
}

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

.toast-body {
  flex: 1;
  line-height: 1.4;
}

.toast-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--color-text-tertiary);
  background: none;
  border: none;
  font-size: 14px;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.toast-close:hover {
  color: var(--color-text);
  background: var(--color-bg-secondary);
}

.toast-success .toast-icon { color: var(--color-develop); }
.toast-error .toast-icon { color: var(--color-ship); }
.toast-info .toast-icon { color: var(--color-link); }

/* ──────────────────────────────────────────────
   COLLAPSIBLE SECTIONS (Notion-style toggle)
   ────────────────────────────────────────────── */
.collapsible {
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  background: var(--color-surface);
  overflow: hidden;
  margin-bottom: var(--space-4);
}

.collapsible-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 14px var(--space-4);
  cursor: pointer;
  user-select: none;
  transition: background 0.15s ease;
}

.collapsible-header:hover {
  background: var(--color-bg-secondary);
}

.collapsible-icon {
  font-size: 16px;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.collapsible.open .collapsible-icon {
  transform: rotate(90deg);
}

.collapsible-title {
  flex: 1;
  font-size: var(--font-size-base);
  font-weight: 500;
  color: var(--color-text);
  letter-spacing: -0.01em;
}

.collapsible-count {
  font-size: var(--font-size-xs);
  color: var(--color-text-tertiary);
  font-weight: 400;
}

.collapsible-toggle {
  color: var(--color-text-secondary);
  font-size: 12px;
  transition: transform 0.2s ease;
}

.collapsible.open .collapsible-toggle {
  transform: rotate(180deg);
}

.collapsible-content {
  display: none;
  padding: 0 var(--space-4) var(--space-4);
  border-top: 1px solid var(--color-border);
}

.collapsible.open .collapsible-content {
  display: block;
}

.collapsible-content-inner {
  padding-top: var(--space-3);
}

/* ──────────────────────────────────────────────
   CARD (Generic)
   ────────────────────────────────────────────── */
.card {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4);
  border-bottom: 1px solid var(--color-border);
}

.card-body {
  padding: var(--space-4);
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--color-border);
}

/* ──────────────────────────────────────────────
   FORM INPUTS
   ────────────────────────────────────────────── */
.input {
  display: block;
  width: 100%;
  padding: 8px 12px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: var(--font-size-base);
  color: var(--color-text);
  background: var(--color-bg);
  box-shadow: var(--shadow-button);
  transition: box-shadow 0.15s ease;
  outline: none;
}

.input:focus {
  box-shadow: 0px 0px 0px 1px var(--color-link);
}

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

.input-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.input-label {
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-text-secondary);
}

.textarea {
  display: block;
  width: 100%;
  padding: 8px 12px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: var(--font-size-base);
  color: var(--color-text);
  background: var(--color-bg);
  box-shadow: var(--shadow-button);
  transition: box-shadow 0.15s ease;
  outline: none;
  resize: vertical;
  min-height: 80px;
}

.textarea:focus {
  box-shadow: 0px 0px 0px 1px var(--color-link);
}

.select {
  display: block;
  width: 100%;
  padding: 8px 12px;
  padding-right: 32px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: var(--font-size-base);
  color: var(--color-text);
  background: var(--color-bg);
  box-shadow: var(--shadow-button);
  transition: box-shadow 0.15s ease;
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23808080' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  cursor: pointer;
}

.select:focus {
  box-shadow: 0px 0px 0px 1px var(--color-link);
}

/* ──────────────────────────────────────────────
   TOGGLE / SWITCH
   ────────────────────────────────────────────── */
.toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
  user-select: none;
}

.toggle-track {
  width: 36px;
  height: 20px;
  border-radius: var(--radius-pill);
  background: var(--color-bg-secondary);
  box-shadow: inset 0px 0px 0px 1px var(--color-border);
  transition: all 0.2s ease;
  position: relative;
  flex-shrink: 0;
}

.toggle.on .toggle-track {
  background: var(--color-link);
  box-shadow: none;
}

.toggle-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: white;
  box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.15);
  position: absolute;
  top: 2px;
  left: 2px;
  transition: transform 0.2s ease;
}

.toggle.on .toggle-thumb {
  transform: translateX(16px);
}

.toggle-label {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
}

/* ──────────────────────────────────────────────
   ADMIN PAGES
   ────────────────────────────────────────────── */
.admin-shell {
  max-width: 1080px;
  margin: 0 auto;
}

.admin-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--color-border);
}

.admin-hero-kicker {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-tertiary);
  margin-bottom: var(--space-1);
}

.admin-hero-title {
  font-size: var(--font-size-2xl);
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--color-text);
  margin: 0;
}

.admin-hero-desc {
  margin: var(--space-2) 0 0;
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  line-height: 1.5;
  max-width: 640px;
}

.admin-hero-actions {
  flex-shrink: 0;
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  align-items: flex-start;
}

.admin-tabs-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: var(--space-5);
  scrollbar-width: thin;
}

.admin-tabs-scroll::-webkit-scrollbar {
  height: 4px;
}

.admin-header {
  margin-bottom: var(--space-6);
}

.admin-tabs {
  display: flex;
  gap: 2px;
  min-width: max-content;
  border-bottom: 1px solid var(--color-border);
}

.admin-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-text-secondary);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: all 0.15s ease;
  margin-bottom: -1px;
  white-space: nowrap;
}

.admin-tab-icon {
  font-size: 15px;
  line-height: 1;
}

.admin-tab-label {
  line-height: 1.2;
}

.admin-tab:hover {
  color: var(--color-text);
  background: var(--color-bg-secondary);
  text-decoration: none;
}

.admin-tab.active {
  color: var(--color-text);
  border-bottom-color: var(--color-accent);
  background: transparent;
}

.admin-page-body {
  padding-bottom: var(--space-8);
}

.admin-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-5);
}

.admin-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

.admin-stat-card {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: var(--space-4);
}

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

.admin-stat-value {
  font-size: var(--font-size-2xl);
  font-weight: 600;
  color: var(--color-text);
  margin-top: var(--space-1);
  line-height: 1.2;
}

.admin-stat-value-sm {
  font-size: var(--font-size-lg);
  font-weight: 500;
}

.admin-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
}

@media (max-width: 768px) {
  .admin-form-grid {
    grid-template-columns: 1fr;
  }

  .admin-hero {
    flex-direction: column;
  }

  .setting-row {
    flex-direction: column;
    gap: var(--space-2);
  }

  .setting-key {
    flex: none;
    width: 100%;
  }
}

.admin-form-grid .setting-row.full-width {
  grid-column: 1 / -1;
}

.admin-danger-zone {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  border: 1px solid rgba(220, 38, 38, 0.25);
  margin-bottom: var(--space-5);
  overflow: hidden;
}

.admin-danger-zone-header {
  padding: var(--space-3) var(--space-5);
  background: rgba(220, 38, 38, 0.06);
  border-bottom: 1px solid rgba(220, 38, 38, 0.15);
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: #dc2626;
}

.admin-danger-zone-body {
  padding: var(--space-4) var(--space-5);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.admin-danger-zone-desc {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  max-width: 520px;
  line-height: 1.5;
}

.llm-analysis-panel {
  margin-top: var(--space-3);
  padding: var(--space-4);
  border-radius: var(--radius-md);
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
}

.llm-analysis-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-2);
}

.llm-analysis-panel-title {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-text);
}

.llm-analysis-panel-pct {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-accent);
  font-variant-numeric: tabular-nums;
}

.llm-analysis-progress-track {
  height: 8px;
  border-radius: var(--radius-pill);
  background: var(--color-bg-subtle);
  overflow: hidden;
  border: 1px solid var(--color-border);
}

.llm-analysis-progress-fill {
  height: 100%;
  border-radius: var(--radius-pill);
  background: linear-gradient(90deg, var(--color-accent), var(--color-link));
  transition: width 0.4s ease;
}

.llm-analysis-stats {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3) var(--space-5);
  margin-top: var(--space-3);
  font-size: var(--font-size-xs);
  color: var(--color-text-secondary);
}

.llm-analysis-stats strong {
  color: var(--color-text);
  font-weight: 600;
}

.llm-analysis-current {
  margin-top: var(--space-2);
  line-height: 1.45;
}

.admin-rag-card {
  margin-bottom: var(--space-5);
}

.admin-rag-stat-grid {
  margin-bottom: var(--space-4);
}

.rag-index-panel {
  margin-bottom: var(--space-4);
}

.admin-rag-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

.admin-rag-settings {
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-border);
}

.admin-rag-settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-4);
}

.integration-section {
  padding-top: var(--space-5);
  margin-top: var(--space-5);
  border-top: 1px solid var(--color-border);
}
.integration-section:first-of-type {
  padding-top: 0;
  margin-top: 0;
  border-top: none;
}

.admin-rag-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.admin-rag-field-label {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
}

.admin-rag-field input[type="range"] {
  width: 100%;
}

.admin-rag-input {
  width: 100%;
  max-width: 120px;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text);
}

.admin-rag-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--font-size-sm);
  color: var(--color-text);
  align-self: end;
}

.rag-model-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.rag-model-badge--ok {
  background: color-mix(in srgb, var(--color-success) 18%, transparent);
  color: var(--color-success);
}

.rag-model-badge--idle {
  background: color-mix(in srgb, var(--color-text-tertiary) 18%, transparent);
  color: var(--color-text-secondary);
}

.rag-model-badge--err {
  background: color-mix(in srgb, #dc2626 15%, transparent);
  color: #dc2626;
}

.admin-rag-danger {
  margin-bottom: 0;
}

.admin-action-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}

.admin-action-card {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.admin-action-card-header {
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--color-border);
  font-weight: 600;
  font-size: var(--font-size-base);
}

.admin-action-card-body {
  padding: var(--space-4) var(--space-5);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.admin-action-card-footer {
  padding: var(--space-3) var(--space-5);
  border-top: 1px solid var(--color-border);
  font-size: var(--font-size-xs);
  color: var(--color-text-tertiary);
  line-height: 1.5;
}

.admin-result-box {
  margin-bottom: var(--space-4);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  line-height: 1.5;
  white-space: pre-wrap;
  max-height: 300px;
  overflow: auto;
  display: none;
}

.admin-result-box.is-visible {
  display: block;
}

.admin-result-box.is-success {
  background: rgba(22, 163, 74, 0.08);
  color: #16a34a;
  border: 1px solid rgba(22, 163, 74, 0.2);
}

.admin-result-box.is-error {
  background: rgba(220, 38, 38, 0.08);
  color: #dc2626;
  border: 1px solid rgba(220, 38, 38, 0.2);
}

.admin-save-bar {
  position: sticky;
  bottom: var(--space-4);
  margin-top: var(--space-5);
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  z-index: 10;
}

.admin-prompt-page {
  width: 100%;
}

.admin-prompt-card {
  margin-bottom: var(--space-5);
}

.admin-prompt-sections {
  display: flex;
  flex-direction: column;
}

.admin-prompt-section {
  padding: var(--space-5);
  border-bottom: 1px solid var(--color-border);
}

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

.admin-prompt-section-head {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.admin-prompt-section-icon {
  font-size: 1.35rem;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 2px;
}

.admin-prompt-section-title {
  margin: 0;
  font-size: var(--font-size-base);
  font-weight: 600;
  color: var(--color-text);
  letter-spacing: -0.01em;
}

.admin-prompt-textarea,
.chat-prompt-textarea,
.extra-prompt-textarea {
  width: 100%;
  display: block;
  box-sizing: border-box;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-mono);
  font-size: var(--font-size-sm);
  line-height: 1.65;
  resize: vertical;
  min-height: 128px;
  outline: none;
  transition:
    border-color var(--transition-fast),
    box-shadow var(--transition-fast),
    background var(--transition-fast);
  -webkit-appearance: none;
  appearance: none;
}

[data-theme="dark"] .admin-prompt-textarea,
[data-theme="dark"] .chat-prompt-textarea,
[data-theme="dark"] .extra-prompt-textarea {
  background: var(--color-bg-secondary);
}

.admin-prompt-textarea--lg {
  min-height: 220px;
}

.admin-prompt-textarea:focus,
.chat-prompt-textarea:focus,
.extra-prompt-textarea:focus {
  border-color: var(--color-link);
  box-shadow: 0 0 0 3px var(--color-link-alpha);
}

.admin-prompt-textarea::placeholder,
.chat-prompt-textarea::placeholder,
.extra-prompt-textarea::placeholder {
  color: var(--color-text-tertiary);
  opacity: 1;
}

.extra-prompt-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.extra-prompt-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--space-3);
  align-items: flex-start;
}

.admin-sections-card {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.admin-content {
  max-width: 900px;
}

/* Admin Settings — Card-based layout */
.admin-card {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  margin-bottom: var(--space-4);
  overflow: hidden;
}

.admin-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--color-border);
}

.admin-card-title {
  font-size: var(--font-size-base);
  font-weight: 500;
  color: var(--color-text);
  letter-spacing: -0.01em;
}

.admin-card-body {
  padding: var(--space-5);
}

.admin-form-group {
  margin-bottom: var(--space-5);
}

.admin-form-group:last-child {
  margin-bottom: 0;
}

.admin-form-label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-text);
  margin-bottom: var(--space-2);
}

.admin-form-desc {
  font-size: var(--font-size-xs);
  color: var(--color-text-tertiary);
  margin-top: var(--space-1);
}

/* Admin Sections — Toggle cards */
.section-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--color-border);
  transition: background 0.15s ease;
}

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

.section-card:hover {
  background: var(--color-bg-secondary);
}

.section-card-info {
  flex: 1;
  min-width: 0;
}

.section-card-name {
  font-size: var(--font-size-base);
  font-weight: 500;
  color: var(--color-text);
  letter-spacing: -0.01em;
}

.section-card-desc {
  font-size: var(--font-size-xs);
  color: var(--color-text-tertiary);
  margin-top: 2px;
}

/* Admin Settings — Settings card */
.settings-group {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  margin-bottom: var(--space-4);
  overflow: hidden;
}

.settings-group-title {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-5);
  font-size: var(--font-size-base);
  font-weight: 600;
  color: var(--color-text);
  border-bottom: 1px solid var(--color-border);
  letter-spacing: -0.01em;
}

.setting-row {
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--color-border);
}

.setting-row:last-child {
  border-bottom: none;
}

.setting-key {
  flex: 0 0 220px;
  min-width: 0;
}

.setting-key code {
  display: block;
  font-family: var(--font-mono);
  font-size: var(--font-size-xs);
  color: var(--color-text-tertiary);
  margin-bottom: 2px;
  word-break: break-all;
}

.setting-desc {
  font-size: var(--font-size-xs);
  color: var(--color-text-tertiary);
  line-height: 1.4;
  margin-top: 4px;
}

.setting-value {
  flex: 1;
  min-width: 0;
}

.setting-value textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-mono);
  font-size: var(--font-size-sm);
  line-height: 1.5;
  resize: vertical;
  outline: none;
  transition: border-color 0.15s ease;
  min-height: 60px;
  box-sizing: border-box;
}

.setting-value textarea:focus {
  border-color: var(--color-accent);
}

.setting-value input[type="text"],
.setting-value input[type="password"] {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-mono);
  font-size: var(--font-size-sm);
  outline: none;
  transition: border-color 0.15s ease;
  box-sizing: border-box;
}

.setting-value input[type="text"]:focus,
.setting-value input[type="password"]:focus {
  border-color: var(--color-accent);
}

.setting-actions {
  flex-shrink: 0;
}

.value-type-badge {
  display: inline-block;
  margin-top: 4px;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 500;
  color: var(--color-text-tertiary);
  background: var(--color-bg-subtle);
  border-radius: var(--radius-pill);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.admin-page-header {
  margin-bottom: var(--space-6);
}

.admin-page-header h1 {
  font-size: var(--font-size-2xl);
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--color-text);
}

/* Chat / Widget prompt editors — see .admin-prompt-textarea above */

.extra-prompt-empty {
  padding: var(--space-6) var(--space-5);
  text-align: center;
  color: var(--color-text-tertiary);
  font-size: var(--font-size-sm);
}

.extra-prompt-row {
  padding: var(--space-3) var(--space-5);
  border-bottom: 1px solid var(--color-border);
}

.extra-prompt-row:last-child {
  border-bottom: none;
}

.extra-prompt-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-2);
}

.extra-prompt-num {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-accent);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.btn-danger-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  color: var(--color-text-tertiary);
  font-size: 14px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
}

.btn-danger-icon:hover {
  background: var(--color-danger-subtle);
  color: var(--color-danger);
}

.extra-prompt-fields {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.extra-prompt-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.extra-prompt-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.extra-prompt-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg);
  color: var(--color-text);
  font-family: inherit;
  font-size: var(--font-size-sm);
  outline: none;
  transition: border-color 0.15s ease;
  box-sizing: border-box;
}

.extra-prompt-input:focus {
  border-color: var(--color-accent);
}

.extra-prompt-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  color: var(--color-text-tertiary);
  font-size: 14px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
  margin-left: auto;
  flex-shrink: 0;
}

.extra-prompt-remove:hover {
  background: var(--color-danger-subtle);
  color: var(--color-danger);
}

.extra-prompt-textarea {
  min-height: 88px;
}

.extra-prompt-textarea:focus {
  border-color: var(--color-accent);
}

/* ──────────────────────────────────────────────
   TRENDS TAB — Components
   ────────────────────────────────────────────── */

/* Grid layout for trends sections */
.trends-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
}
.trends-section-full { grid-column: 1 / -1; }

/* Section header inside card */
.trends-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5) 0;
}
.trends-section-title {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-text);
  letter-spacing: -0.01em;
}
.trends-section-body { padding: var(--space-3) var(--space-5) var(--space-5); }
.trends-section-body-np { padding: 0 var(--space-5) var(--space-4); }

/* Topic Cloud */
.topic-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding: var(--space-1) 0;
}
.topic-pill-wrapper { position: relative; display: inline-block; }
.topic-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-text-secondary);
  background: var(--color-bg-subtle);
  border: 1px solid var(--color-border);
  cursor: pointer;
  transition: all var(--transition-fast);
  user-select: none;
}
.topic-pill:hover {
  border-color: var(--color-accent);
  background: var(--color-accent-bg);
  color: var(--color-accent);
  text-decoration: none;
}
.topic-pill-active {
  border-color: var(--color-accent);
  background: var(--color-accent-bg);
  color: var(--color-accent);
  box-shadow: 0 0 0 1px var(--color-accent);
}
.topic-pill-count {
  font-size: 11px;
  color: var(--color-text-tertiary);
  background: var(--color-surface);
  border-radius: 10px;
  padding: 1px 7px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.topic-pill:hover .topic-pill-count { background: var(--color-accent-bg); }
.topic-pill-active .topic-pill-count { background: var(--color-accent-bg); }

/* Topic popup */
.topic-popup {
  position: absolute;
  z-index: 100;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  min-width: 220px;
  max-width: 300px;
  background: var(--color-surface);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: var(--space-3);
}
.topic-popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-2);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--color-border);
}
.topic-popup-header strong { font-size: var(--font-size-sm); font-weight: 600; }
.topic-popup-meetings {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 150px;
  overflow-y: auto;
}
.topic-popup-meeting {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 0;
  font-size: var(--font-size-xs);
  color: var(--color-text-secondary);
  text-decoration: none;
  transition: color var(--transition-fast);
}
.topic-popup-meeting:hover { color: var(--color-link); }
.topic-popup-meeting-title { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-right: 8px; }
.topic-popup-meeting-date { flex-shrink: 0; }

/* Sentiment Chart */
.sentiment-chart { width: 100%; }
.sentiment-chart svg { width: 100%; height: auto; }
.sentiment-legend {
  display: flex;
  gap: var(--space-4);
  margin-top: var(--space-2);
}
.sentiment-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--font-size-xs);
  color: var(--color-text-tertiary);
}
.sentiment-legend-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.sentiment-legend-dot.positive { background: var(--color-success); }
.sentiment-legend-dot.neutral { background: var(--color-text-tertiary); }
.sentiment-legend-dot.negative { background: var(--color-danger); }
.sentiment-legend-dot.trend { background: var(--color-link); width: 14px; height: 2px; border-radius: 0; }

/* Speaker Rankings */
.speaker-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.speaker-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.speaker-rank {
  width: 20px;
  font-size: var(--font-size-xs);
  font-weight: 600;
  color: var(--color-text-tertiary);
  text-align: right;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}
.speaker-name {
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-text);
  min-width: 100px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.speaker-bar-track {
  flex: 1;
  height: 6px;
  background: var(--color-border-light);
  border-radius: 3px;
  overflow: hidden;
}
.speaker-bar-fill {
  height: 100%;
  background: var(--color-accent);
  border-radius: 3px;
  transition: width var(--transition-base);
}
.speaker-count {
  font-size: var(--font-size-xs);
  font-weight: 600;
  color: var(--color-text-secondary);
  min-width: 24px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

/* Action Items Funnel */
.action-funnel {
  display: flex;
  gap: var(--space-2);
}
.action-funnel-card {
  flex: 1;
  text-align: center;
  padding: var(--space-3) var(--space-2);
  border-radius: var(--radius-md);
  background: var(--color-bg-subtle);
  border: 1px solid var(--color-border);
}
.action-funnel-value {
  font-size: var(--font-size-2xl);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
}
.action-funnel-value.created { color: var(--color-accent); }
.action-funnel-value.open { color: var(--color-warning); }
.action-funnel-value.done { color: var(--color-success); }
.action-funnel-value.unresolved { color: var(--color-danger); }
.action-funnel-label {
  font-size: var(--font-size-xs);
  color: var(--color-text-tertiary);
  margin-top: 2px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* Status table (inside funnel) */
.action-table { width: 100%; border-collapse: collapse; margin-top: var(--space-3); }
.action-table td {
  padding: var(--space-1) 0;
  font-size: var(--font-size-sm);
  border-bottom: 1px solid var(--color-border-light);
}
.action-table td:last-child { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }

/* Assignee list */
.assignee-list { margin-top: var(--space-3); }
.assignee-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-1) 0;
  font-size: var(--font-size-sm);
}
.assignee-name { color: var(--color-text); font-weight: 500; }
.assignee-count { color: var(--color-text-tertiary); font-size: var(--font-size-xs); font-variant-numeric: tabular-nums; }

/* Activity Calendar */
.activity { display: flex; flex-direction: column; gap: var(--space-1); }
.activity-row {
  display: grid;
  grid-template-columns: 64px 1fr 90px;
  align-items: center;
  gap: var(--space-3);
}
.activity-label { font-size: var(--font-size-xs); font-weight: 500; color: var(--color-text-secondary); }
.activity-bar-track {
  height: 8px;
  background: var(--color-border-light);
  border-radius: 4px;
  overflow: hidden;
}
.activity-bar {
  height: 100%;
  border-radius: 4px;
  background: var(--color-accent);
  transition: width var(--transition-base);
}
.activity-bar.muted { background: var(--color-text-tertiary); opacity: 0.35; }
.activity-values {
  font-size: var(--font-size-xs);
  color: var(--color-text-tertiary);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Empty state for trends */
.trends-empty {
  text-align: center;
  padding: var(--space-8) var(--space-4);
  color: var(--color-text-tertiary);
}
.trends-empty-icon { font-size: 28px; margin-bottom: var(--space-2); }
.trends-empty-text { font-size: var(--font-size-sm); }

/* Horizontal rule for inside cards */
.card-hr { border: none; border-top: 1px solid var(--color-border-light); margin: var(--space-3) 0; }

/* Priority row */
.priority-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.priority-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.priority-dot.high { background: var(--color-danger); }
.priority-dot.medium { background: var(--color-warning); }
.priority-dot.low { background: var(--color-text-tertiary); }

/* ──────────────────────────────────────────────
   CHAT WIDGET (Embeddable for meeting detail page)
   ────────────────────────────────────────────── */
.chat-toggle-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1000;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--color-accent);
    color: var(--color-text-inverse);
    border: none;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0,0,0,0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, opacity 0.2s ease;
}
.chat-toggle-btn:hover {
    transform: scale(1.08);
    box-shadow: var(--shadow-lg);
}
.chat-toggle-btn.hidden {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.6);
}

.chat-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 999;
    width: 400px;
    max-width: calc(100vw - 48px);
    height: 520px;
    max-height: calc(100dvh - 48px);
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 16px;
    box-shadow: var(--shadow-widget);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-size: 14px;
    color: var(--color-text);
    transition: transform 0.25s ease, opacity 0.25s ease;
    transform-origin: bottom right;
    box-sizing: border-box;
}
.chat-widget.closed {
    transform: scale(0.8);
    opacity: 0;
    pointer-events: none;
}

/* ── Header (minimal, like RAG chat) ── */
.chat-widget .chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px;
    background: var(--color-bg);
    color: var(--color-text);
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
}
.chat-widget .chat-header-info {
    flex: 1;
    min-width: 0;
}
.chat-widget .chat-header-title {
    font-weight: 600;
    font-size: 17px;
    letter-spacing: -0.01em;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--color-text);
    min-width: 0;
}
.chat-widget .chat-header-meta {
    font-size: 12px;
    color: var(--color-text-tertiary);
    margin-top: 2px;
}
.chat-widget .chat-header-close {
    background: none;
    border: none;
    color: var(--color-text-secondary);
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
    opacity: 0.85;
    transition: opacity 0.15s, color 0.15s;
    line-height: 1;
    flex-shrink: 0;
}
.chat-widget .chat-header-close:hover {
    opacity: 1;
    color: var(--color-text);
}

/* ── Filters ── */
.chat-filters-toggle {
    display: block;
    width: 100%;
    padding: 8px 16px;
    background: var(--color-bg);
    border: none;
    border-bottom: 1px solid var(--color-border);
    color: var(--color-text-secondary);
    font-size: 12px;
    cursor: pointer;
    text-align: left;
    flex-shrink: 0;
    transition: background 0.15s;
}
.chat-filters-toggle:hover {
    background: var(--color-accent-bg);
}
.chat-filters-toggle::after {
    content: " ▾";
    font-size: 10px;
}
.chat-filters-toggle.open::after {
    content: " ▴";
}

.chat-filters-body {
    padding: 8px 16px 12px;
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
    display: none;
    flex-shrink: 0;
}
.chat-filters-body.open {
    display: block;
}
.chat-filters-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.chat-filters-grid .full-width {
    grid-column: 1 / -1;
}
.chat-filters-body label {
    display: block;
    font-size: 11px;
    color: var(--color-text-secondary);
    margin-bottom: 3px;
    font-weight: 500;
}
.chat-filters-body select,
.chat-filters-body input {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    background: var(--color-bg);
    color: var(--color-text);
    font-size: 13px;
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.15s;
}
.chat-filters-body select:focus,
.chat-filters-body input:focus {
    border-color: var(--color-accent);
}
.chat-filters-body select option {
    background: var(--color-bg);
    color: var(--color-text);
}

/* Legacy flat input layout (chat_widget.html without wrap) */
.chat-widget .chat-input-area:has(> .chat-input) {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--color-border);
    background: var(--color-bg);
}
.chat-widget .chat-input-area > .chat-input {
    flex: 1;
    min-width: 0;
    padding: 8px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    background: var(--color-bg);
    color: var(--color-text);
    font-size: 14px;
    font-family: inherit;
    resize: none;
    outline: none;
    min-height: 20px;
    max-height: 80px;
}
.chat-widget .chat-input-area > .chat-input:focus {
    border-color: var(--color-accent);
}
.chat-widget .chat-msg-user {
    align-self: flex-end;
    padding: 10px 16px;
    background: var(--color-accent);
    color: var(--color-text-inverse);
    border-radius: var(--radius-lg);
    border-bottom-right-radius: 4px;
}
.chat-widget .chat-msg-assistant {
    align-self: flex-start;
    padding: 12px 16px;
    background: var(--color-bg-secondary);
    color: var(--color-text);
    border-radius: var(--radius-lg);
    border-bottom-left-radius: 4px;
}

/* Responsive — meeting chat widget on mobile */
@media (max-width: 768px) {
    .chat-widget:not(.closed) {
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        max-width: 100%;
        height: min(88dvh, 100dvh);
        max-height: 100dvh;
        border-radius: 16px 16px 0 0;
        border-left: none;
        border-right: none;
        border-bottom: none;
        transform-origin: bottom center;
    }

    .chat-widget .chat-header {
        border-radius: 16px 16px 0 0;
    }

    .chat-toggle-btn {
        bottom: calc(16px + env(safe-area-inset-bottom, 0px));
        right: calc(16px + env(safe-area-inset-right, 0px));
    }

    .chat-widget .chat-messages {
        padding-left: 12px;
        padding-right: 12px;
    }

    .chat-widget .chat-input-area {
        padding-left: 12px;
        padding-right: 12px;
        padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    }

    .chat-widget .chat-msg {
        max-width: 92%;
    }

    .chat-filters-grid {
        grid-template-columns: 1fr;
    }
}

/* ──────────────────────────────────────────────
   TRANSCRIPT — Chat-style transcript viewer
   ────────────────────────────────────────────── */
.transcript-toolbar {
  margin-bottom: var(--space-4);
}
.transcript-search-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.transcript-search-input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: var(--font-size-sm);
  outline: none;
  transition: border-color 0.15s;
}
.transcript-search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 20%, transparent);
}
.transcript-search-count {
  font-size: var(--font-size-xs);
  color: var(--text-tertiary);
  white-space: nowrap;
  padding: 4px 8px;
  background: var(--bg-secondary);
  border-radius: var(--radius);
}
.transcript-container {
  max-height: 600px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-primary);
  padding: var(--space-4);
}
.transcript-msg {
  margin-bottom: 2px;
}
.transcript-msg.same-speaker {
  margin-top: -2px;
}
.transcript-speaker-row {
  display: flex;
  align-items: center;
  margin-top: 12px;
  margin-bottom: 4px;
}
.transcript-msg:first-child .transcript-speaker-row {
  margin-top: 0;
}
.transcript-speaker-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--font-size-xs);
  font-weight: 600;
  color: var(--speaker-color, var(--text-primary));
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.speaker-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.speaker-chip {
  display: inline-flex !important;
  align-items: center;
  gap: 4px;
}
.speaker-chip .speaker-dot {
  width: 6px;
  height: 6px;
}
.transcript-bubble {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 4px 8px 4px 12px;
  border-left: 2px solid transparent;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  transition: background 0.15s, border-color 0.15s;
}
.transcript-bubble:hover {
  background: var(--bg-secondary);
}
.transcript-bubble.highlighted {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  border-left-color: var(--accent);
}
.transcript-bubble.remark-critic {
  background: color-mix(in srgb, #ef4444 8%, transparent);
  border-left-color: #ef4444;
}
.transcript-bubble.remark-praise {
  background: color-mix(in srgb, #22c55e 8%, transparent);
  border-left-color: #22c55e;
}
.transcript-bubble.remark-negative {
  background: color-mix(in srgb, #f97316 6%, transparent);
  border-left-color: #f97316;
}
.transcript-tone-badge {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}
.remark-badge-critic {
  color: #ef4444;
  background: color-mix(in srgb, #ef4444 12%, transparent);
}
.remark-badge-praise {
  color: #16a34a;
  background: color-mix(in srgb, #22c55e 12%, transparent);
}
.sentiment-arc-card {
  overflow: hidden;
}
.sentiment-arc-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin-bottom: var(--space-3);
}
.sentiment-arc-title {
  display: block;
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 2px;
}
.sentiment-arc-jump {
  cursor: pointer;
  border: none;
  font-size: 11px;
}
.sentiment-arc-skeleton {
  height: 140px;
  width: 100%;
  border-radius: var(--radius-md);
}
.sentiment-arc-body {
  position: relative;
}
.sentiment-arc-svg {
  display: block;
  width: 100%;
  height: 112px;
}
.sentiment-arc-midline {
  stroke: var(--color-border, rgba(255,255,255,0.12));
  stroke-width: 1;
  stroke-dasharray: 4 4;
}
.sentiment-arc-bar {
  opacity: 0.9;
  transition: opacity 0.15s;
}
.sentiment-arc-bar--pos { fill: #22c55e; }
.sentiment-arc-bar--neu { fill: #64748b; }
.sentiment-arc-bar--neg { fill: #ef4444; }
.sentiment-arc-seg.is-hovered .sentiment-arc-bar { opacity: 1; }
.sentiment-arc-seg.has-critic .sentiment-arc-bar--neg { fill: #dc2626; }
.sentiment-arc-dot {
  stroke: var(--color-bg, #0a0a0a);
  stroke-width: 1.5;
  pointer-events: none;
}
.sentiment-arc-line {
  stroke: var(--color-link, #60a5fa);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
  opacity: 0.85;
}
.sentiment-arc-critic-mark {
  fill: #ef4444;
  font-size: 11px;
  font-weight: 700;
  pointer-events: none;
}
.sentiment-arc-axis {
  display: flex;
  justify-content: space-between;
  margin-top: 4px;
  font-size: 10px;
  color: var(--color-text-tertiary);
  font-family: var(--font-mono);
}
.sentiment-arc-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
  font-size: 11px;
  color: var(--color-text-secondary);
  align-items: center;
}
.sentiment-arc-swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  margin-right: 4px;
  vertical-align: -1px;
}
.sentiment-arc-swatch--pos { background: #22c55e; }
.sentiment-arc-swatch--neu { background: #64748b; }
.sentiment-arc-swatch--neg { background: #ef4444; }
.sentiment-arc-tooltip {
  margin-top: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  background: var(--color-bg-secondary);
  font-size: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.sentiment-arc-tooltip-critic { color: #ef4444; font-weight: 600; }
.sentiment-arc-tooltip-praise { color: #22c55e; font-weight: 600; }
.transcript-text {
  flex: 1;
  font-size: var(--font-size-sm);
  line-height: 1.6;
  color: var(--text-primary);
}
.transcript-text mark {
  background: #fde047;
  color: #1a1a2e;
  padding: 0 2px;
  border-radius: 2px;
}
[data-theme="dark"] .transcript-text mark {
  background: #854d0e;
  color: #fef9c3;
}
.transcript-time {
  font-size: var(--font-size-xs);
  color: var(--text-tertiary);
  white-space: nowrap;
  font-family: var(--font-mono);
  padding-top: 2px;
  flex-shrink: 0;
}
.transcript-sentiment {
  flex-shrink: 0;
  font-size: 14px;
  line-height: 1;
  padding-top: 2px;
}

/* ──────────────────────────────────────────────
   RAG CHAT — Full-page Chat
   ────────────────────────────────────────────── */
.chat-page {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--space-8) * 2);
  max-height: calc(100vh - var(--space-8) * 2);
}

.chat-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.chat-page-header-left {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.chat-page-avatar {
  font-size: 28px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-accent-bg);
  border-radius: var(--radius-md);
  flex-shrink: 0;
}

.chat-page-title {
  font-size: var(--font-size-lg);
  font-weight: 600;
  color: var(--color-text);
  letter-spacing: -0.02em;
}

.chat-page-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--font-size-xs);
  color: var(--color-text-tertiary);
  margin-top: 2px;
}

.chat-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-develop);
  display: inline-block;
}

.chat-page-messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-6) var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.chat-message {
  display: flex;
  gap: var(--space-3);
  max-width: 780px;
}

.chat-message.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.chat-message-avatar {
  font-size: 22px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-accent-bg);
  border-radius: 50%;
  flex-shrink: 0;
}

.chat-message-body {
  flex: 1;
  min-width: 0;
}

.chat-message-sender {
  font-size: var(--font-size-xs);
  font-weight: 600;
  color: var(--color-text-tertiary);
  margin-bottom: 4px;
  letter-spacing: -0.01em;
}

.chat-message.user .chat-message-sender {
  display: none;
}

.chat-message-bubble {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: var(--font-size-base);
  line-height: 1.6;
  color: var(--color-text);
}

.chat-message-bubble.bot {
  background: var(--color-surface);
  box-shadow: var(--shadow-card);
}

.chat-message-bubble.user {
  background: var(--color-accent);
  color: white;
  box-shadow: var(--shadow-card);
}

.chat-message-bubble.user a {
  color: rgba(255, 255, 255, 0.85);
  text-decoration: underline;
}

/* Typing indicator */
.chat-typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-left: 4px;
}

.chat-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-text-tertiary);
  animation: chat-bounce 1.4s ease-in-out infinite;
}

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

@keyframes chat-bounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

/* Chat Input Area */
.chat-page-input {
  border-top: 1px solid var(--color-border);
  padding: var(--space-4) var(--space-5);
  flex-shrink: 0;
}

.chat-input-wrapper {
  display: flex;
  align-items: flex-end;
  gap: var(--space-2);
  padding: 8px 12px;
  border-radius: var(--radius-md);
  background: var(--color-surface);
  box-shadow: var(--shadow-card);
  transition: box-shadow 0.15s ease;
}

.chat-input-wrapper:focus-within {
  box-shadow: var(--shadow-card-hover);
}

.chat-attach-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  background: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 16px;
  color: var(--color-text-tertiary);
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.chat-attach-btn:hover {
  background: var(--color-bg-secondary);
  color: var(--color-text);
}

.chat-page-textarea {
  flex: 1;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: var(--font-size-base);
  color: var(--color-text);
  outline: none;
  resize: none;
  min-height: 24px;
  max-height: 120px;
  line-height: 1.5;
  padding: 4px 0;
}

.chat-page-textarea::placeholder {
  color: var(--color-text-tertiary);
}

.chat-send-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--color-accent);
  color: var(--color-bg);
  cursor: pointer;
  font-size: 16px;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.chat-send-btn:hover:not(:disabled) {
  background: var(--color-accent-hover);
}

.chat-send-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.chat-input-footer {
  display: flex;
  justify-content: center;
  margin-top: var(--space-2);
}

/* ── rag_chat.html — full-page RAG chat styles ── */
/* These classes are used by rag_chat.html template. */
/* JS-logic references them, so CSS moved from inline <style> to here. */

/* ══════════════════════════════════════════════
   VARIANT 1: MINIMAL / LINEAR-STYLE — Chat Sessions
   ══════════════════════════════════════════════ */

/* ── Chat page as flex row: sidebar + chat ── */
.chat-page-wrapper {
  flex: 1;
  display: flex;
  flex-direction: row;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

.page-content:has(.chat-page-wrapper) {
  overflow: hidden;
  padding: 0;
  display: flex;
  flex-direction: column;
}
.page-content:has(.chat-page-wrapper) .page-content-inner {
  flex: 1;
  display: flex;
  flex-direction: row;
  max-width: 100%;
  min-width: 0;
  width: 100%;
  overflow: hidden;
}
.page-content:has(.chat-page-wrapper) .section-header {
  display: none;
}

/* ── Session sidebar — ultra minimal ── */
.chat-sidebar {
  width: 280px;
  min-width: 280px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--color-border);
  background: var(--color-bg);
  flex-shrink: 0;
  overflow: hidden;
}

.chat-sidebar-header {
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}
.chat-sidebar-header h2 {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 12px;
}

.chat-sidebar-new-btn {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: transparent;
  color: var(--color-text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s;
}
.chat-sidebar-new-btn:hover {
  background: var(--color-bg-hover);
  border-color: var(--color-border-strong);
  color: var(--color-text);
}

.chat-sidebar-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

/* ── Session item ── */
.chat-session-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  margin-bottom: 2px;
  transition: background 0.12s;
}
.chat-session-item:hover {
  background: var(--color-bg-hover);
}
.chat-session-item.active {
  background: var(--color-accent-bg);
}

.chat-session-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
  background: var(--color-bg-subtle);
}
.chat-session-item.active .chat-session-icon {
  background: var(--color-accent-subtle);
}

.chat-session-info {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}
.chat-session-title {
  display: block;
  width: 100%;
  max-width: 100%;
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-session-meta {
  font-size: 11px;
  color: var(--color-text-tertiary);
  margin-top: 2px;
}

.chat-session-delete {
  opacity: 0;
  width: 24px;
  height: 24px;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: 4px;
  font-size: 14px;
  color: var(--color-text-tertiary);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.12s;
}
.chat-session-item:hover .chat-session-delete {
  opacity: 1;
}
.chat-session-delete:hover {
  background: var(--color-danger-subtle);
  color: var(--color-danger);
}

/* ── Inline rename input ── */
.chat-session-title-edit {
  display: block;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--color-accent);
  border-radius: 4px;
  padding: 2px 6px;
  background: var(--color-surface);
  color: var(--color-text);
  outline: none;
  font-family: inherit;
  min-width: 0;
}

/* ── Chat area — clean centered ── */
.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  max-width: 740px;
  width: 100%;
  margin: 0 auto;
  padding: 0 24px;
  position: relative;
  overflow: hidden;
}

.chat-header-bar {
  padding: 20px 0 16px;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}
.chat-header-bar h1 {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--color-text);
}
.chat-header-bar p {
  font-size: 13px;
  color: var(--color-text-tertiary);
  margin-top: 2px;
}

.chat-header-title--editable {
  cursor: pointer;
}
.chat-header-title--editable:active {
  opacity: 0.75;
}

/* ── Messages area ── */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scroll-behavior: smooth;
  min-width: 0;
}
.chat-widget .chat-messages {
  padding: 16px;
  gap: 16px;
}
.chat-messages::-webkit-scrollbar { width: 6px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 3px; }

.chat-msg {
  max-width: 85%;
  line-height: 1.55;
  font-size: 14px;
  animation: chatMsgIn 0.2s ease-out;
  overflow-wrap: anywhere;
  word-break: break-word;
}
@keyframes chatMsgIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.chat-msg.assistant {
  align-self: flex-start;
  padding: 12px 16px;
  background: var(--color-bg-secondary);
  border-radius: var(--radius-lg);
  border-bottom-left-radius: 4px;
  color: var(--color-text);
  min-width: 0;
}
.chat-msg.user {
  align-self: flex-end;
  padding: 10px 16px;
  background: var(--color-accent);
  color: var(--color-text-inverse);
  border-radius: var(--radius-lg);
  border-bottom-right-radius: 4px;
}
.chat-msg.system {
  align-self: center;
  max-width: 60%;
  background: var(--color-accent-bg);
  color: var(--color-text-secondary);
  font-size: var(--font-size-xs);
  border-radius: 20px;
  padding: 6px 16px;
  text-align: center;
}

/* Message formatting */
.chat-msg.assistant p { margin: 0.4rem 0; }
.chat-msg.assistant p:first-child { margin-top: 0; }
.chat-msg.assistant p:last-child { margin-bottom: 0; }
.chat-msg.assistant strong { font-weight: 600; }
.chat-msg.assistant em { font-style: italic; }
.chat-msg.assistant ul, .chat-msg.assistant ol { padding-left: 1.5rem; margin: 0.4rem 0; }
.chat-msg.assistant li { margin: 0.2rem 0; }
.chat-msg.assistant .chat-label-line {
  margin: 0.2rem 0;
  padding-left: 1.5rem;
}
.chat-msg.assistant h1, .chat-msg.assistant h2, .chat-msg.assistant h3, .chat-msg.assistant h4 { margin: 0.6rem 0 0.3rem; font-weight: 600; }
.chat-msg.assistant h1 { font-size: 1.2rem; }
.chat-msg.assistant h2 { font-size: 1.1rem; }
.chat-msg.assistant h3 { font-size: 1.05rem; }
.chat-msg.assistant h4 { font-size: 1rem; }
.chat-msg.assistant h5 { font-size: 0.95rem; font-weight: 600; margin: 0.5rem 0 0.2rem; }
.chat-msg.assistant h6 { font-size: 0.9rem; font-weight: 600; margin: 0.5rem 0 0.2rem; }
.chat-msg.assistant hr { border: none; border-top: 1px solid var(--color-border); margin: 0.6rem 0; }
.chat-msg.assistant code {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  background: var(--color-accent-bg);
  padding: 0.15rem 0.4rem;
  border-radius: var(--radius-sm);
}
.chat-msg.assistant pre {
  background: var(--color-bg-subtle);
  border: 1px solid var(--color-border);
  padding: var(--space-3);
  border-radius: var(--radius-md);
  overflow-x: auto;
  max-width: 100%;
  margin: var(--space-2) 0;
}
.chat-msg.assistant pre code { background: none; padding: 0; border: none; }
.chat-msg.assistant img,
.chat-msg.assistant table {
  max-width: 100%;
}
.chat-msg.assistant table {
  display: block;
  overflow-x: auto;
}

/* Sources toggle + list */
.chat-msg .sources-toggle {
  font-size: var(--font-size-xs);
  color: var(--color-text-tertiary);
  cursor: pointer;
  margin-top: var(--space-2);
  user-select: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.chat-msg .sources-toggle:hover { color: var(--color-accent); }
.chat-msg .sources {
  margin-top: var(--space-2);
  display: none;
  flex-direction: column;
  gap: 4px;
}
.chat-msg .sources.visible { display: flex; }
.chat-msg .sources a {
  padding: 4px 8px;
  font-size: var(--font-size-xs);
  color: var(--color-accent);
  text-decoration: none;
  border-radius: var(--radius-sm);
  background: var(--color-accent-bg);
  transition: background var(--transition-fast);
}
.chat-msg .sources a:hover { background: var(--color-accent-subtle); text-decoration: none; }
.chat-msg .sources .src-score { color: var(--color-text-tertiary); font-size: 0.75rem; }

/* ── Typing indicator ── */
.chat-typing {
  align-self: flex-start;
  display: none;
  gap: 4px;
  padding: 12px 20px;
  background: var(--color-bg-secondary);
  border-radius: var(--radius-lg);
  border-bottom-left-radius: 4px;
  margin-top: -8px;
}
.chat-typing.active { display: inline-flex; }
.chat-msg.assistant .chat-typing--inline {
  display: inline-flex;
  margin: 0;
  padding: 0;
  background: transparent;
  border: none;
}
.chat-typing span {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--color-text-tertiary);
  animation: chatBounce 1.4s infinite ease-in-out both;
}
.chat-typing span:nth-child(1) { animation-delay: -0.32s; }
.chat-typing span:nth-child(2) { animation-delay: -0.16s; }
@keyframes chatBounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

/* ── Stop button ── */
.chat-stop {
  display: none;
  justify-content: center;
  padding: var(--space-1) 0;
  flex-shrink: 0;
}
.chat-stop.active { display: flex; }
.chat-stop-btn {
  font-size: var(--font-size-xs);
  font-weight: 500;
  padding: 4px 16px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.chat-stop-btn:hover { border-color: var(--color-danger); color: var(--color-danger); }

/* ── Input area (override widget flex layout) ── */
.chat-page-wrapper .chat-input-area,
.chat-widget .chat-input-area {
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  padding: 12px 0 20px;
  flex-shrink: 0;
  border-top: none;
  background: transparent;
}
.chat-widget .chat-input-area {
  padding: 12px 16px 16px;
}
.chat-page-wrapper .chat-input-wrap,
.chat-widget .chat-input-wrap {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  padding: 10px 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-bg);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.chat-page-wrapper .chat-input-wrap:focus-within,
.chat-widget .chat-input-wrap:focus-within {
  border-color: var(--color-accent);
  box-shadow: inset 0 0 0 1px var(--color-accent);
}
.chat-page-wrapper .chat-input-wrap textarea,
.chat-widget .chat-input-wrap textarea {
  flex: 1 1 0;
  min-width: 0;
  border: none;
  background: transparent;
  outline: none;
  font-family: inherit;
  font-size: 14px;
  color: var(--color-text);
  resize: none;
  line-height: 20px;
  min-height: 32px;
  height: 32px;
  padding: 6px 0;
  margin: 0;
  max-height: 120px;
  overflow-y: hidden;
  box-sizing: border-box;
}
.chat-page-wrapper .chat-input-wrap textarea::placeholder,
.chat-widget .chat-input-wrap textarea::placeholder { color: var(--color-text-tertiary); }
.chat-page-wrapper .chat-input-wrap textarea:disabled,
.chat-widget .chat-input-wrap textarea:disabled { opacity: 0.5; cursor: not-allowed; }

.chat-page-wrapper .chat-send-btn,
.chat-widget .chat-send-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--color-accent);
  color: var(--color-text-inverse);
  border: none;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  transform: none;
}
.chat-page-wrapper .chat-send-btn:hover,
.chat-widget .chat-send-btn:hover { background: var(--color-accent-hover); transform: scale(1.05); }
.chat-page-wrapper .chat-send-btn:disabled,
.chat-widget .chat-send-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.chat-page-wrapper .chat-send-btn svg,
.chat-widget .chat-send-btn svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  margin-left: 0;
}

/* ── Empty state ── */
.chat-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 20px;
}
.chat-empty-icon { font-size: 48px; margin-bottom: 16px; opacity: 0.6; }
.chat-empty h3 { font-size: 16px; font-weight: 600; color: var(--color-text); margin-bottom: 6px; }
.chat-empty p { font-size: 13px; color: var(--color-text-tertiary); max-width: 300px; line-height: 1.5; }

/* Input footer */
.chat-footer {
  display: flex;
  justify-content: space-between;
  margin-top: var(--space-1);
  padding: 0 2px;
  font-size: var(--font-size-xs);
  color: var(--color-text-tertiary);
}

/* Animations */
@keyframes chatFadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes chatBounce {
  0%, 80%, 100% { transform: scale(0.6); }
  40% { transform: scale(1); }
}

/* Mobile chat drawer (variant A) */
.chat-drawer-open-btn,
.chat-header-new-btn,
.chat-drawer-backdrop {
  display: none;
}

.chat-drawer-open-btn {
  position: relative;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: var(--color-accent);
  color: var(--color-text-inverse);
  cursor: pointer;
  flex-shrink: 0;
}
.chat-drawer-open-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.chat-drawer-open-btn:active {
  background: var(--color-accent-hover);
}

.chat-session-count {
  position: absolute;
  top: -5px;
  right: -5px;
  font-size: 10px;
  font-weight: 700;
  background: #ffffff;
  color: #1d4ed8;
  padding: 0 4px;
  border-radius: 999px;
  min-width: 17px;
  height: 17px;
  line-height: 13px;
  text-align: center;
  border: 2px solid #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .chat-session-count {
  background: #2a2b2e;
  color: #f7f8f8;
  border-color: #2a2b2e;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.55);
}

.chat-header-new-btn {
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: var(--color-accent);
  color: var(--color-text-inverse);
  font-size: 20px;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}
.chat-header-new-btn:active {
  background: var(--color-accent-hover);
}

.chat-header-info {
  flex: 1;
  min-width: 0;
}

/* Responsive — mobile */
@media (max-width: 640px) {
  .page-content:has(.chat-page-wrapper) {
    overflow-x: hidden;
  }

  .page-content:has(.chat-page-wrapper) .page-content-inner {
    flex-direction: column;
  }

  .chat-page-wrapper {
    position: relative;
    flex: 1;
    min-height: 0;
    width: 100%;
    max-width: 100%;
    flex-direction: column;
    overflow-x: clip;
  }

  .chat-sidebar {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(300px, 86vw);
    min-width: 0;
    max-width: 86vw;
    flex: none;
    z-index: 50;
    transform: translateX(-100%);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 8px 0 32px rgba(0, 0, 0, 0.12);
  }
  .chat-sidebar.drawer-open {
    transform: translateX(0);
  }

  .chat-drawer-backdrop {
    display: block;
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    z-index: 40;
  }
  .chat-drawer-backdrop.open {
    opacity: 1;
    pointer-events: auto;
  }

  .chat-drawer-open-btn,
  .chat-header-new-btn {
    display: flex;
  }

  .chat-main {
    flex: 1 1 auto;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    min-height: 0;
    margin: 0;
    padding: 0 12px;
    overflow-x: hidden;
  }

  .chat-header-bar {
    display: grid;
    grid-template-columns: 36px 1fr 36px;
    align-items: center;
    gap: 8px;
    padding: 12px 0;
    min-width: 0;
  }

  .chat-header-info {
    text-align: center;
  }

  .chat-header-info h1,
  .chat-header-info p {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .chat-messages {
    padding: 16px 0;
    gap: 12px;
    overflow-x: hidden;
    min-width: 0;
  }

  .chat-input-area {
    padding: 12px 0 calc(20px + env(safe-area-inset-bottom, 0px));
    min-width: 0;
  }

  .chat-page-wrapper .chat-input-wrap,
  .chat-widget .chat-input-wrap {
    padding: 8px 10px;
    max-width: 100%;
  }

  .chat-page-wrapper .chat-input-wrap textarea,
  .chat-widget .chat-input-wrap textarea {
    font-size: 16px;
  }

  .chat-msg {
    max-width: 92%;
  }
  .chat-msg.system {
    max-width: 88%;
  }

  .chat-session-delete {
    opacity: 1;
  }
}

/* ──────────────────────────────────────────────
   SEARCH PAGE
   ────────────────────────────────────────────── */
.search-container {
  margin-bottom: var(--space-6);
}

.search-input-wrapper {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: var(--color-surface);
  box-shadow: var(--shadow-card);
  transition: box-shadow 0.2s ease;
  margin-bottom: var(--space-4);
}

.search-input-wrapper:focus-within {
  box-shadow: var(--shadow-card-hover);
}

.search-input-icon {
  font-size: 18px;
  flex-shrink: 0;
  opacity: 0.5;
}

.search-input {
  flex: 1;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: var(--font-size-lg);
  color: var(--color-text);
  outline: none;
}

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

.search-clear {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: none;
  background: var(--color-bg-secondary);
  color: var(--color-text-tertiary);
  cursor: pointer;
  font-size: 12px;
}

.search-filters {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.search-filter-label {
  font-size: var(--font-size-xs);
  color: var(--color-text-tertiary);
  font-weight: 500;
  white-space: nowrap;
}

.search-results-meta {
  margin-bottom: var(--space-4);
}

.search-result-card {
  display: flex;
  gap: var(--space-4);
  padding: var(--space-4);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  box-shadow: var(--shadow-card);
  transition: box-shadow 0.15s ease;
  margin-bottom: var(--space-2);
}

.search-result-card:hover {
  box-shadow: var(--shadow-card-hover);
}

.search-result-icon {
  font-size: 22px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-accent-bg);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.search-result-body {
  flex: 1;
  min-width: 0;
}

.search-result-title {
  font-size: var(--font-size-base);
  font-weight: 500;
  color: var(--color-text);
  margin-bottom: 4px;
}

.search-result-title a {
  color: var(--color-text);
  text-decoration: none;
}

.search-result-title a:hover {
  color: var(--color-link);
  text-decoration: underline;
}

.search-result-title mark {
  background: var(--color-mark-bg);
  color: var(--color-mark-text);
  padding: 0 2px;
  border-radius: 2px;
}

[data-theme="dark"] .search-result-title mark {
  background: var(--color-mark-bg);
  color: var(--color-mark-text);
}

.search-result-meta {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--font-size-xs);
  color: var(--color-text-tertiary);
  margin-bottom: var(--space-2);
  flex-wrap: wrap;
}

.search-result-date {
  color: var(--color-text-tertiary);
}

.search-result-context {
  color: var(--color-text-tertiary);
}

.search-result-meta-sep {
  color: var(--color-border);
}

.search-result-snippet {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  line-height: 1.5;
}

.search-result-snippet mark {
  background: var(--color-mark-bg);
  color: var(--color-mark-text);
  padding: 0 2px;
  border-radius: 2px;
}

[data-theme="dark"] .search-result-snippet mark {
  background: var(--color-mark-bg);
  color: var(--color-mark-text);
}

/* ──────────────────────────────────────────────
   STACKED BAR CHARTS
   ────────────────────────────────────────────── */
.stacked-bar-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.stacked-bar-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.stacked-bar-label {
  width: 32px;
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-text-secondary);
  flex-shrink: 0;
}

.stacked-bar-track {
  flex: 1;
  height: 24px;
  display: flex;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--color-bg-secondary);
}

.stacked-bar-segment {
  height: 100%;
  transition: width 0.3s ease;
  cursor: help;
}

.sg-dev { background: var(--color-develop); }
.sg-review { background: var(--color-preview); }
.sg-sync { background: var(--color-link); }

.stacked-bar-total {
  width: 40px;
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-text-tertiary);
  text-align: right;
  flex-shrink: 0;
}

.stacked-bar-legend {
  display: flex;
  gap: var(--space-4);
  margin-top: var(--space-4);
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-border);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--font-size-xs);
  color: var(--color-text-tertiary);
}

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

/* ──────────────────────────────────────────────
   CALENDAR PAGE
   ────────────────────────────────────────────── */

/* ── Page Layout ── */
.calendar-page {
  max-width: var(--content-max-width, 1200px);
}

/* ── Navigation ── */
.calendar-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-6);
  flex-wrap: wrap;
  gap: var(--space-3);
}

.calendar-nav-left {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.calendar-nav-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--color-text);
  margin: 0;
  min-width: 160px;
}

.calendar-nav-arrows {
  display: flex;
  align-items: center;
  gap: 4px;
}

.calendar-nav-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-button);
  color: var(--color-text-secondary);
  font-size: 16px;
  transition: all 0.15s ease;
  text-decoration: none;
}

.calendar-nav-btn:hover {
  box-shadow: var(--shadow-button-hover);
  color: var(--color-text);
  background: var(--color-accent-bg);
  text-decoration: none;
}

.calendar-today-btn {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-button);
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  transition: all 0.15s ease;
  text-decoration: none;
}

.calendar-today-btn:hover {
  box-shadow: var(--shadow-button-hover);
  color: var(--color-text);
  background: var(--color-accent-bg);
}

/* ── Mode Switcher ── */
.calendar-mode-switch {
  display: flex;
  gap: 2px;
  padding: 3px;
  background: var(--color-surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-border);
}

.calendar-mode-btn {
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: var(--font-size-sm);
  font-weight: 400;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
  white-space: nowrap;
}

.calendar-mode-btn:hover {
  color: var(--color-text);
  background: var(--color-accent-bg);
}

.calendar-mode-btn.active {
  color: var(--color-text);
  font-weight: 500;
  background: var(--color-bg);
  box-shadow: 0px 1px 3px rgba(0,0,0,0.08);
}

/* ── Month View ── */
.calendar-month-view {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.calendar-header-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background: var(--color-bg-secondary);
  border-bottom: 1px solid var(--color-border);
}

.calendar-header-cell {
  padding: 10px 8px;
  font-size: 11px;
  font-weight: 500;
  color: var(--color-text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-align: center;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

.calendar-day-cell {
  min-height: 100px;
  padding: 8px;
  border-right: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  transition: background 0.15s ease;
}

.calendar-day-cell:nth-child(7n) {
  border-right: none;
}

.calendar-day-cell:hover {
  background: var(--color-bg-hover);
}

.calendar-day-cell.today {
  background: var(--color-accent-bg);
}

.calendar-day-cell.today .calendar-day-number a {
  font-weight: 600;
  color: var(--color-accent);
}

.calendar-day-empty {
  opacity: 0.35;
  min-height: 100px;
  border-right: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
}

.calendar-day-empty:nth-child(7n) {
  border-right: none;
}

.calendar-day-number {
  margin-bottom: 6px;
}

.calendar-day-number a {
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-text-secondary);
  text-decoration: none;
}

.calendar-day-number a:hover {
  color: var(--color-link);
}

/* ── Meeting Dots ── */
.calendar-day-meetings {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.calendar-meeting-dot {
  display: block;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  color: var(--color-text-inverse);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: opacity 0.15s ease;
}

.calendar-meeting-dot:hover {
  opacity: 0.85;
}

.calendar-meeting-dot.duration-short {
  background: var(--color-develop);
}

.calendar-meeting-dot.duration-medium {
  background: var(--color-preview);
}

.calendar-meeting-dot.duration-long {
  background: var(--color-ship);
}

.calendar-meeting-dot::before {
  content: "● ";
  font-size: 8px;
}

.calendar-more {
  font-size: 11px;
  color: var(--color-text-tertiary);
  padding: 2px 8px;
  cursor: pointer;
}

.calendar-more:hover {
  color: var(--color-link);
}

/* ── Week View ── */
.calendar-week-view {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.calendar-week-col {
  background: var(--color-surface);
  min-height: 400px;
  display: flex;
  flex-direction: column;
}

.calendar-week-col.today {
  background: var(--color-accent-bg);
}

.calendar-week-header {
  text-align: center;
  padding: 12px 8px;
  border-bottom: 1px solid var(--color-border);
}

.calendar-week-dayname {
  font-size: 11px;
  font-weight: 500;
  color: var(--color-text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.calendar-week-daynum a {
  font-size: 18px;
  font-weight: 600;
  color: var(--color-text);
  text-decoration: none;
}

.calendar-week-daynum a:hover {
  color: var(--color-link);
}

.calendar-week-body {
  flex: 1;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.calendar-meeting-block {
  display: block;
  padding: 6px 8px;
  border-radius: 4px;
  font-size: 11px;
  text-decoration: none;
  transition: opacity 0.15s ease;
}

.calendar-meeting-block.duration-short {
  background: var(--color-dev-bg);
  border-left: 3px solid var(--color-develop);
  color: var(--color-develop);
}

.calendar-meeting-block.duration-medium {
  background: var(--color-preview-bg);
  border-left: 3px solid var(--color-preview);
  color: var(--color-preview);
}

.calendar-meeting-block.duration-long {
  background: var(--color-ship-bg);
  border-left: 3px solid var(--color-ship);
  color: var(--color-ship);
}

.calendar-meeting-block:hover {
  opacity: 0.8;
}

.calendar-meeting-title {
  font-weight: 600;
  display: block;
}

.calendar-meeting-dur {
  font-size: 10px;
  opacity: 0.7;
}

.calendar-week-empty {
  font-size: 11px;
  color: var(--color-text-tertiary);
  text-align: center;
  padding: 16px 0;
}

/* ── Day View ── */
.calendar-day-view {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.calendar-day-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-border);
}

.calendar-day-header h2 {
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text);
  margin: 0;
}

.calendar-day-count {
  font-size: var(--font-size-sm);
  color: var(--color-text-tertiary);
}

.calendar-day-timeline {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.calendar-meeting-card {
  display: flex;
  align-items: stretch;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: var(--color-bg);
  box-shadow: var(--shadow-border);
  transition: box-shadow 0.15s ease;
  text-decoration: none;
}

.calendar-meeting-card:hover {
  box-shadow: var(--shadow-card-hover);
}

.calendar-meeting-color {
  width: 4px;
  border-radius: 2px;
  flex-shrink: 0;
}

.calendar-meeting-color.duration-short {
  background: var(--color-develop);
}

.calendar-meeting-color.duration-medium {
  background: var(--color-preview);
}

.calendar-meeting-color.duration-long {
  background: var(--color-ship);
}

.calendar-meeting-info {
  flex: 1;
  min-width: 0;
}

.calendar-meeting-info .calendar-meeting-title {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 2px;
}

.calendar-meeting-meta {
  font-size: 11px;
  color: var(--color-text-tertiary);
}

/* ── Calendar Skeleton ── */
.calendar-skeleton {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  background: var(--color-surface);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.calendar-skeleton-cell {
  aspect-ratio: 1;
  background: var(--color-skeleton);
  animation: skeleton-pulse 1.5s ease-in-out infinite;
  background-size: 200% 100%;
}

/* ──────────────────────────────────────────────
   TEAMS PAGE
   ────────────────────────────────────────────── */

/* ── Teams Grid ── */
.teams-page {
  max-width: var(--content-max-width, 1200px);
}

.teams-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
}

@media (max-width: 1024px) {
  .teams-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

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

.team-card-link {
  text-decoration: none;
  display: block;
}

.team-card {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.team-card:hover {
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-1px);
}

.team-card-accent {
  height: 4px;
  flex-shrink: 0;
}

.team-card-header {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4);
}

.team-card-avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-sm);
  font-weight: 600;
  flex-shrink: 0;
}

.team-card-info {
  flex: 1;
  min-width: 0;
}

.team-card-name {
  font-size: var(--font-size-base);
  font-weight: 600;
  color: var(--color-text);
  margin: 0 0 2px 0;
}

.team-card-desc {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.team-card-stats {
  display: flex;
  gap: var(--space-4);
  padding: 0 var(--space-4) var(--space-3);
}

.team-card-stat {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.team-card-stat-value {
  font-size: var(--font-size-lg);
  font-weight: 600;
  color: var(--color-text);
}

.team-card-stat-label {
  font-size: 11px;
  color: var(--color-text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.team-card-members {
  display: flex;
  gap: 4px;
  padding: 0 var(--space-4) var(--space-3);
  flex-wrap: wrap;
}

.team-member-avatar-sm {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 600;
}

.team-member-extra {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: var(--color-text-tertiary);
  background: var(--color-bg-secondary);
}

.team-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--color-border);
}

.team-card-activity {
  font-size: 11px;
  color: var(--color-text-tertiary);
}

.team-card-arrow {
  font-size: var(--font-size-sm);
  color: var(--color-text-tertiary);
}

/* ── Team Detail ── */
.team-detail-header {
  margin-bottom: var(--space-6);
}

.team-detail-title-row {
  margin-bottom: var(--space-3);
}

.back-link {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  text-decoration: none;
  transition: color 0.15s ease;
}

.back-link:hover {
  color: var(--color-link);
}

.team-detail-hero {
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
}

.team-detail-avatar-lg {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 600;
  flex-shrink: 0;
}

.team-detail-hero-info {
  flex: 1;
  min-width: 0;
}

.team-detail-name {
  font-size: 22px;
  font-weight: 700;
  color: var(--color-text);
  margin: 0 0 4px 0;
}

.team-detail-desc {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  margin: 0 0 var(--space-3) 0;
}

.team-detail-meta {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.team-detail-meta-item {
  font-size: var(--font-size-xs);
  color: var(--color-text-tertiary);
}

.team-detail-content {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

.team-section-card {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.team-section-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--color-border);
}

.team-section-title {
  font-size: var(--font-size-base);
  font-weight: 600;
  color: var(--color-text);
  margin: 0;
}

.team-section-count {
  font-size: var(--font-size-sm);
  color: var(--color-text-tertiary);
  background: var(--color-bg-secondary);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
}

.team-section-body {
  padding: var(--space-4) var(--space-5);
}

.team-members-grid {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.team-member-card {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--color-border);
}

.team-member-card:last-child {
  border-bottom: none;
}

.team-member-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-sm);
  font-weight: 600;
  flex-shrink: 0;
}

.team-member-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.team-member-name {
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-text);
}

.team-member-role {
  font-size: 11px;
  color: var(--color-text-tertiary);
}

.team-meetings-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.team-meeting-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--color-border);
  text-decoration: none;
  transition: opacity 0.15s ease;
}

.team-meeting-row:last-child {
  border-bottom: none;
}

.team-meeting-row:hover {
  opacity: 0.8;
}

.team-meeting-status {
  font-size: 16px;
  flex-shrink: 0;
}

.team-meeting-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.team-meeting-title {
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-text);
}

.team-meeting-date {
  font-size: 11px;
  color: var(--color-text-tertiary);
}

.team-empty {
  text-align: center;
  padding: var(--space-8) 0;
}

.team-empty-text {
  color: var(--color-text-tertiary);
}

.team-activity-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.team-activity-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
}

.team-activity-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 5px;
}

.team-activity-body {
  flex: 1;
}

.team-activity-text {
  display: block;
  font-size: var(--font-size-sm);
  color: var(--color-text);
}

.team-activity-time {
  font-size: 11px;
  color: var(--color-text-tertiary);
}

/* ──────────────────────────────────────────────
   SCROLLBAR STYLING
   ────────────────────────────────────────────── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

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

::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-tertiary);
}

/* ──────────────────────────────────────────────
   RESPONSIVE BREAKPOINTS
   ────────────────────────────────────────────── */

/* Tablet: 640px - 1024px */
@media (max-width: 1024px) {
  .sidebar {
    width: var(--sidebar-collapsed);
    min-width: var(--sidebar-collapsed);
  }

  .sidebar-item-label,
  .sidebar-logo-text,
  .sidebar-section-label,
  .sidebar-divider {
    display: none;
  }

  .sidebar-logo {
    display: flex;
    justify-content: center;
    padding: var(--space-4) 0 var(--space-5);
  }

  .sidebar-nav {
    padding: 0 6px;
  }

  .sidebar-item {
    justify-content: center;
    padding: var(--space-2);
  }

  .sidebar-item-icon {
    margin: 0;
  }

  .stat-cards {
    grid-template-columns: repeat(2, 1fr);
  }

  .sidebar-footer .user-name,
  .sidebar-footer .sidebar-divider {
    display: none;
  }

  .sidebar-footer-inner {
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 0 6px var(--space-3);
  }

  .sidebar-footer-left {
    flex: none;
    order: 2;
  }

  .sidebar-footer-right {
    flex-direction: column;
    align-items: center;
    gap: 2px;
    order: 1;
  }

  .sidebar-user {
    justify-content: center;
  }

  .sidebar-footer-right .theme-toggle,
  .sidebar-footer-right .sidebar-footer-icon {
    width: 32px;
    height: 32px;
  }

  .page-content {
    padding: var(--space-6) var(--space-5);
  }

  .meeting-table-header,
  .meeting-table-row {
    grid-template-columns: 2fr 1fr 1fr 80px;
  }

  .meeting-table-cell.hide-tablet,
  .meeting-table-header .hide-tablet {
    display: none;
  }

  .hide-tablet {
    display: none;
  }

  /* Trends responsive — tablet */
  .trends-grid {
    grid-template-columns: 1fr;
  }
  .action-funnel {
    flex-wrap: wrap;
  }
  .action-funnel-card {
    min-width: calc(50% - var(--space-2));
  }
}

/* Mobile: < 640px */
@media (max-width: 640px) {
  .chat-panel {
    position: fixed;
    bottom: 0;
    right: 0;
    width: 100%;
    height: 100%;
    border-radius: 0;
  }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 44;
  }

  .mobile-topbar {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-shrink: 0;
    min-height: 52px;
    padding: var(--space-2) var(--space-3);
    border-bottom: 1px solid var(--color-border);
    background: var(--color-bg);
    z-index: 30;
  }

  .mobile-topbar-title {
    flex: 1;
    min-width: 0;
    text-align: center;
  }

  .mobile-topbar-brand {
    display: block;
    font-size: var(--font-size-base);
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--color-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .mobile-topbar-spacer {
    width: 40px;
    flex-shrink: 0;
  }

  .hamburger {
    display: flex;
    position: static;
    top: auto;
    left: auto;
    z-index: auto;
  }

  .sidebar {
    position: fixed;
    left: -280px;
    width: 260px;
    min-width: 260px;
    transition: left 0.25s ease;
    box-shadow: var(--shadow-card-hover);
    z-index: 45;
    pointer-events: auto;
    touch-action: auto;
  }

  .sidebar.open {
    left: 0;
    z-index: 55;
  }

  .sidebar-item-label,
  .sidebar-logo-text,
  .sidebar-section-label,
  .sidebar-divider {
    display: block;
  }

  .sidebar-logo {
    display: flex;
    justify-content: flex-start;
    padding: var(--space-4) var(--space-4) var(--space-5);
  }

  .sidebar-nav {
    padding: 0 var(--space-2);
  }

  .sidebar-item {
    justify-content: flex-start;
    padding: var(--space-2) var(--space-3);
  }

  .sidebar-item-icon {
    margin: 0;
  }

  /* Sidebar footer — desktop layout on mobile overlay */
  .sidebar-footer .user-name,
  .sidebar-footer .sidebar-divider {
    display: flex;
  }

  .sidebar-footer-inner {
    flex-direction: row;
    justify-content: space-between;
    padding: 0 var(--space-2) var(--space-3);
  }

  .sidebar-footer-left {
    flex: 1;
    order: unset;
  }

  .sidebar-footer-right {
    flex-direction: row;
    order: unset;
  }

  .page-content {
    padding: var(--space-4) var(--space-3) var(--space-5);
  }

  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
  }

  .section-title {
    font-size: var(--font-size-lg);
    line-height: 1.3;
    word-break: break-word;
  }

  .section-title-group {
    width: 100%;
    min-width: 0;
  }

  .section-action {
    align-self: flex-start;
  }

  .admin-hero {
    margin-top: 0;
    padding-top: 0;
  }

  .admin-hero-title {
    font-size: var(--font-size-xl);
    line-height: 1.25;
  }

  .admin-hero-kicker {
    font-size: 10px;
  }

  .admin-tabs-scroll {
    margin-left: calc(-1 * var(--space-3));
    margin-right: calc(-1 * var(--space-3));
    padding-left: var(--space-3);
    padding-right: var(--space-3);
  }

  .page-content:has(.chat-page-wrapper) {
    padding: 0;
  }

  .page-content:has(.chat-page-wrapper) .mobile-topbar {
    flex-shrink: 0;
  }

  .stat-cards {
    grid-template-columns: 1fr;
  }

  .meeting-table-header,
  .meeting-table-row {
    grid-template-columns: 2fr 1fr 80px;
  }

  .meeting-table-cell.hide-tablet,
  .meeting-table-header .hide-tablet {
    display: none;
  }

  .meeting-table-cell.hide-mobile,
  .meeting-table-header .hide-mobile {
    display: none;
  }

  .hide-tablet {
    display: none;
  }

  .hide-mobile {
    display: none;
  }

  .meeting-row {
    flex-wrap: wrap;
    gap: var(--space-2);
  }

  .meeting-status {
    margin-left: auto;
  }

  .pagination {
    gap: 2px;
  }

  .pagination-item {
    width: 28px;
    height: 28px;
    font-size: var(--font-size-xs);
  }

  /* Trends responsive — mobile */
  .trends-grid {
    grid-template-columns: 1fr;
  }
  .trends-section-header {
    padding: var(--space-3) var(--space-4) 0;
    flex-wrap: wrap;
    gap: var(--space-1);
  }
  .trends-section-body {
    padding: var(--space-2) var(--space-4) var(--space-4);
  }
  .action-funnel {
    flex-wrap: wrap;
  }
  .action-funnel-card {
    min-width: calc(50% - var(--space-2));
  }
  .activity-row {
    grid-template-columns: 50px 1fr 75px;
    gap: var(--space-2);
  }
  .speaker-name {
    min-width: 70px;
  }
}

/* ──────────────────────────────────────────────
   ANIMATIONS
   ────────────────────────────────────────────── */
@media (prefers-reduced-motion: no-preference) {
  @keyframes fadeInUp {
    from {
      opacity: 0;
      transform: translateY(12px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
}

/* ── Sidebar GCal Status ── */
.sidebar-gcal-status {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  vertical-align: middle;
  margin-left: 2px;
}

.sidebar-gcal-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  vertical-align: middle;
}

.sidebar-gcal-dot.connected {
  background: var(--color-success);
  box-shadow: 0 0 0 2px var(--color-success-subtle);
}

.sidebar-gcal-dot.disconnected {
  background: var(--color-text-tertiary);
}

/* ──────────────────────────────────────────────
   GOOGLE CALENDAR
   ────────────────────────────────────────────── */

/* ── Connection Status ── */
.gcal-status-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--font-size-base);
}

.gcal-status-indicator {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.gcal-connected {
  background: var(--color-success);
  box-shadow: 0 0 0 3px var(--color-success-subtle);
}

.gcal-disconnected {
  background: var(--color-text-tertiary);
  box-shadow: 0 0 0 3px var(--color-bg-subtle);
}

/* ── Status Stats Grid ── */
.gcal-status-details {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: var(--space-3);
}

.gcal-stat {
  background: var(--color-bg-subtle);
  border-radius: 8px;
  padding: var(--space-3);
  text-align: center;
}

.gcal-stat-value {
  display: block;
  font-size: var(--font-size-xl);
  font-weight: 700;
  color: var(--color-text);
  line-height: 1.2;
}

.gcal-stat-label {
  display: block;
  font-size: var(--font-size-xs);
  color: var(--color-text-tertiary);
  margin-top: 2px;
}

/* ── Sync Result ── */
.gcal-sync-result {
  background: var(--color-success-subtle);
  border-radius: 8px;
  padding: var(--space-3) var(--space-4);
  font-size: var(--font-size-sm);
  line-height: 1.6;
}

/* ── Calendar List ── */
.gcal-calendar-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--color-border);
  border-radius: 8px;
  overflow: hidden;
}

.gcal-calendar-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface);
  transition: background 0.15s ease;
}

.gcal-calendar-row:hover {
  background: var(--color-bg-hover);
}

.gcal-calendar-color {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  flex-shrink: 0;
}

.gcal-calendar-info {
  flex: 1;
  min-width: 0;
}

.gcal-calendar-name {
  font-size: var(--font-size-base);
  font-weight: 500;
  color: var(--color-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gcal-calendar-meta {
  font-size: var(--font-size-xs);
  color: var(--color-text-tertiary);
  margin-top: 1px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Event Source Filter ── */
.calendar-source-filter {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
  flex-wrap: wrap;
}

.source-filter-label {
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-text-secondary);
}

.source-filter-btn {
  padding: 4px 12px;
  border-radius: 6px;
  font-size: var(--font-size-sm);
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-secondary);
  transition: all 0.15s ease;
}

.source-filter-btn:hover {
  border-color: var(--color-accent);
  color: var(--color-text);
}

.source-filter-btn.active {
  background: var(--color-accent-bg);
  border-color: var(--color-accent-border);
  color: var(--color-accent);
}

/* ── Event Source Badge ── */
.event-source-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 7px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  line-height: 1.5;
}

.event-source-badge.gcal {
  background: #e8f0fe;
  color: #1967d2;
}

.event-source-badge.fireflies {
  background: #fef3c7;
  color: #92400e;
}

.event-source-badge.matched {
  background: #e3f5ec;
  color: #1a8a5a;
}

/* ── GCal Calendar Meeting Dot/Block ── */
.calendar-meeting-dot.source-gcal {
  background: #4285f4;
}

.calendar-meeting-dot.source-gcal::before {
  content: "G ";
  font-size: 8px;
  font-weight: 700;
}

.calendar-meeting-dot.source-fireflies {
  background: var(--color-develop);
}

.calendar-meeting-block.source-gcal {
  border-left: 3px solid #4285f4;
  background: #f0f6ff;
}

.calendar-meeting-block.source-fireflies {
  border-left: 3px solid var(--color-develop);
}

.calendar-meeting-card.source-gcal {
  border-left: 4px solid #4285f4;
}

.calendar-meeting-card.source-fireflies {
  border-left: 4px solid var(--color-develop);
}

.calendar-meeting-card.matched-meeting {
  border-left: 4px solid var(--color-success);
}

/* ── GCal Link Icon ── */
.gcal-link-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 700;
  cursor: help;
}

.gcal-link-icon.matched {
  background: var(--color-success-subtle);
  color: var(--color-success);
}

/* ── Meeting Card Caption Line ── */
.calendar-meeting-card {
  position: relative;
}

.calendar-meeting-card .gcal-link-icon {
  position: absolute;
  top: var(--space-2);
  right: var(--space-2);
}

/* ──────────────────────────────────────────────
   ADMIN — Analytics blocks
   ────────────────────────────────────────────── */
.analytics-admin-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
}

.analytics-admin-stats {
  flex-shrink: 0;
}

.analytics-stat-pill {
  display: inline-block;
  padding: 6px 12px;
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-text-secondary);
  background: var(--color-bg-subtle);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
}

.analytics-admin-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-5);
}

.analytics-admin-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: var(--space-5);
  align-items: start;
}

@media (max-width: 960px) {
  .analytics-admin-layout {
    grid-template-columns: 1fr;
  }
}

.analytics-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.analytics-block-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg);
  transition: background 0.15s ease, box-shadow 0.15s ease;
  cursor: default;
}

.analytics-block-item:last-child {
  border-bottom: none;
}

.analytics-block-item.dragging {
  opacity: 0.55;
  background: var(--color-bg-subtle);
}

.analytics-block-item.drag-over {
  box-shadow: inset 0 2px 0 var(--color-link);
}

.drag-handle {
  color: var(--color-text-tertiary);
  cursor: grab;
  font-size: 18px;
  line-height: 1;
  user-select: none;
  flex-shrink: 0;
}

.drag-handle:active {
  cursor: grabbing;
}

.block-icon {
  font-size: 20px;
  line-height: 1;
  flex-shrink: 0;
  width: 28px;
  text-align: center;
}

.block-info {
  flex: 1;
  min-width: 0;
}

.block-label-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.block-label {
  font-weight: 600;
  font-size: var(--font-size-sm);
  color: var(--color-text);
}

.block-source-badge {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  background: var(--color-bg-subtle);
  color: var(--color-text-tertiary);
  border: 1px solid var(--color-border);
}

.block-desc {
  font-size: var(--font-size-xs);
  color: var(--color-text-secondary);
  margin-top: 2px;
  line-height: 1.45;
}

.block-meta {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: 6px;
  flex-wrap: wrap;
}

.block-category-tag {
  font-size: 10px;
  font-weight: 500;
  color: var(--color-accent);
  background: var(--color-accent-subtle, rgba(99, 102, 241, 0.12));
  padding: 2px 8px;
  border-radius: var(--radius-pill);
}

.block-key-code {
  font-size: 10px;
  color: var(--color-text-tertiary);
  background: transparent;
  padding: 0;
}

.toggle-switch {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
  user-select: none;
  flex-shrink: 0;
}

.toggle-switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-switch .toggle-track,
.toggle-slider {
  width: 36px;
  height: 20px;
  border-radius: var(--radius-pill);
  background: var(--color-bg-secondary);
  box-shadow: inset 0 0 0 1px var(--color-border);
  transition: background 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  flex-shrink: 0;
  display: inline-block;
}

.toggle-switch .toggle-track::after,
.toggle-slider::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
  transition: transform 0.2s ease;
}

.toggle-switch input:checked + .toggle-track,
.toggle-switch input:checked + .toggle-slider {
  background: var(--color-link);
  box-shadow: none;
}

.toggle-switch input:checked + .toggle-track::after,
.toggle-switch input:checked + .toggle-slider::after {
  transform: translateX(16px);
}

.toggle-switch .toggle-label {
  font-size: var(--font-size-xs);
  color: var(--color-text-tertiary);
  min-width: 28px;
}

.analytics-category-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.analytics-cat-btn {
  display: block;
  width: 100%;
  text-align: left;
  padding: var(--space-2) var(--space-3);
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text-secondary);
  font-size: var(--font-size-sm);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.analytics-cat-btn:hover {
  background: var(--color-bg-hover);
  color: var(--color-text);
}

.analytics-cat-btn.active {
  background: var(--color-bg-subtle);
  color: var(--color-text);
  font-weight: 500;
}

.section-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--color-border);
  transition: background 0.15s ease;
}

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

.section-row:hover {
  background: var(--color-bg-secondary);
}

.section-row.disabled {
  opacity: 0.55;
}

.section-row-main {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  flex: 1;
  min-width: 0;
}

.section-row-icon {
  font-size: 22px;
  line-height: 1;
  flex-shrink: 0;
  width: 32px;
  text-align: center;
  margin-top: 2px;
}

.section-row-info {
  flex: 1;
  min-width: 0;
}

.section-label {
  font-weight: 600;
  font-size: var(--font-size-sm);
  color: var(--color-text);
}

.section-row-desc {
  font-size: var(--font-size-xs);
  color: var(--color-text-secondary);
  margin-top: 2px;
  line-height: 1.45;
}

.section-row-path {
  font-size: 11px;
  color: var(--color-text-tertiary);
  margin-top: 4px;
  font-family: var(--font-mono);
}

/* ── Speaker co-participation network graph ── */
.speaker-network-card {
  margin-bottom: var(--space-6);
}

.speaker-network-card.is-expanded {
  position: fixed;
  inset: 0;
  z-index: 10000;
  margin: 0;
  border-radius: 0;
  max-height: none;
  display: flex;
  flex-direction: column;
  background: var(--color-bg);
  box-sizing: border-box;
}

.speaker-network-card.is-expanded .card-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  height: 100%;
  min-height: 0;
  box-sizing: border-box;
}

.speaker-network-card.is-expanded .speaker-network-stage {
  flex: 1;
  height: auto;
  min-height: 0;
  display: flex;
}

.speaker-network-card.is-expanded .speaker-network-canvas-wrap {
  flex: 1;
  height: auto;
  min-height: 280px;
}

body.speaker-network-expanded-open {
  overflow: hidden;
}

.speaker-network-expand-btn {
  margin-left: 4px;
  font-size: 13px;
}

.speaker-network-stage {
  display: flex;
  align-items: stretch;
  height: 480px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--color-bg-secondary);
}

.speaker-network-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

.speaker-network-zoom {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

.speaker-network-zoom-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg);
  color: var(--color-text-secondary);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.speaker-network-zoom-btn:hover {
  background: var(--color-bg-secondary);
  border-color: var(--color-accent);
  color: var(--color-text);
}

.speaker-network-zoom-reset {
  font-size: 14px;
  margin-left: 4px;
}

.speaker-network-zoom-level {
  min-width: 42px;
  text-align: center;
  font-size: var(--font-size-xs);
  font-variant-numeric: tabular-nums;
  color: var(--color-text-tertiary);
}

.speaker-network-slider {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
}

.speaker-network-slider input[type="range"] {
  width: 140px;
  accent-color: var(--color-accent);
}

.speaker-network-type-filter {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
}

.speaker-network-type-filter[hidden] {
  display: none;
}

.speaker-network-type-select {
  min-width: 120px;
  max-width: 160px;
  padding: 4px 8px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg);
  color: var(--color-text);
  font-size: var(--font-size-sm);
  cursor: pointer;
}

.speaker-network-type-select:hover,
.speaker-network-type-select:focus {
  border-color: var(--color-accent);
  outline: none;
}

.speaker-network-stats {
  font-size: var(--font-size-xs);
  color: var(--color-text-tertiary);
}

.speaker-network-focus {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 6px 10px;
  background: var(--color-accent-bg);
  border: 1px solid color-mix(in srgb, var(--color-accent) 25%, var(--color-border));
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
}

.speaker-network-focus[hidden] {
  display: none;
}

.speaker-network-focus-label strong {
  color: var(--color-accent);
}

.speaker-network-focus-clear {
  padding: 4px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg);
  color: var(--color-text-secondary);
  font-size: var(--font-size-xs);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.speaker-network-focus-clear:hover {
  background: var(--color-bg-secondary);
  border-color: var(--color-accent);
  color: var(--color-text);
}

.speaker-network-canvas-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
  min-height: 0;
  height: 100%;
  background: transparent;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
}

.speaker-network-panel {
  width: 300px;
  flex-shrink: 0;
  min-height: 0;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--color-bg);
  border-left: 1px solid var(--color-border);
}

.speaker-network-panel[hidden] {
  display: none;
}

.speaker-network-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-2);
  flex-shrink: 0;
  padding: var(--space-4);
  border-bottom: 1px solid var(--color-border);
}

.speaker-network-panel-title {
  margin: 0;
  font-size: var(--font-size-sm);
  font-weight: 600;
  line-height: 1.35;
  color: var(--color-text);
}

.speaker-network-panel-meta {
  margin: 4px 0 0;
  font-size: var(--font-size-xs);
  color: var(--color-text-tertiary);
}

.speaker-network-panel-close {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg);
  color: var(--color-text-secondary);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.speaker-network-panel-close:hover {
  background: var(--color-bg-secondary);
  border-color: var(--color-accent);
  color: var(--color-text);
}

.speaker-network-panel-list {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: var(--space-2);
}

.speaker-network-meeting-item {
  display: block;
  padding: 10px 12px;
  margin-bottom: 4px;
  border-radius: var(--radius-md);
  text-decoration: none;
  color: inherit;
  transition: background 0.15s ease;
}

.speaker-network-meeting-item:hover {
  background: var(--color-bg-secondary);
}

.speaker-network-meeting-item:last-child {
  margin-bottom: 0;
}

.speaker-network-meeting-title {
  display: block;
  font-size: var(--font-size-sm);
  font-weight: 500;
  line-height: 1.4;
  color: var(--color-text);
}

.speaker-network-meeting-meta {
  display: block;
  margin-top: 3px;
  font-size: var(--font-size-xs);
  color: var(--color-text-tertiary);
}

.speaker-network-panel-empty {
  margin: var(--space-4);
  font-size: var(--font-size-sm);
  color: var(--color-text-tertiary);
  text-align: center;
}

.speaker-network-canvas-wrap.is-panning {
  cursor: grabbing;
}

.speaker-network-canvas-wrap svg {
  display: block;
  width: 100%;
  height: 100%;
  user-select: none;
}

.speaker-network-hint {
  position: absolute;
  right: 10px;
  bottom: 8px;
  font-size: 10px;
  color: var(--color-text-tertiary);
  opacity: 0.7;
  pointer-events: none;
}

.speaker-network-edge {
  stroke: var(--color-text-tertiary);
  fill: none;
  stroke-linecap: round;
  pointer-events: none;
  transition: stroke 0.2s ease, stroke-opacity 0.25s ease, opacity 0.3s ease;
}

.speaker-network-edge-hit {
  stroke: transparent;
  fill: none;
  stroke-linecap: round;
  stroke-width: 12px;
  pointer-events: stroke;
  cursor: pointer;
}

.speaker-network-edge-group {
  cursor: pointer;
}

.speaker-network-edge.entering {
  opacity: 0;
}

.speaker-network-edge.highlight {
  stroke: var(--color-accent);
}

.speaker-network-edge.dimmed {
  opacity: 0.08;
}

.speaker-network-node {
  transition: opacity 0.25s ease;
}

.speaker-network-node circle {
  fill: var(--color-accent);
  stroke: var(--color-bg);
  stroke-width: 1.5px;
  cursor: pointer;
  transition: fill 0.2s ease, r 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.speaker-network-node.entering circle {
  opacity: 0;
  transform-origin: center;
}

.speaker-network-node text {
  font-size: 9px;
  font-weight: 500;
  fill: var(--color-text-secondary);
  pointer-events: none;
  text-anchor: middle;
  transition: opacity 0.25s ease;
}

.speaker-network-node.highlight circle {
  fill: var(--color-link);
}

.speaker-network-node.focused circle {
  fill: var(--color-link);
  stroke: var(--color-accent);
  stroke-width: 2px;
}

.speaker-network-node.dimmed {
  opacity: 0.25;
}

.speaker-network-node.dimmed circle {
  fill: var(--color-border);
}

.speaker-network-tooltip {
  position: absolute;
  z-index: 10;
  pointer-events: none;
  padding: 8px 10px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  font-size: var(--font-size-xs);
  line-height: 1.4;
  max-width: 220px;
  opacity: 0;
  transition: opacity 0.12s ease;
}

.speaker-network-tooltip.visible {
  opacity: 1;
}

.speaker-network-tooltip strong {
  display: block;
  font-size: var(--font-size-sm);
  margin-bottom: 2px;
}

.speaker-network-empty {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  pointer-events: none;
  text-align: center;
  font-size: var(--font-size-sm);
  line-height: 1.45;
  color: var(--color-text-tertiary);
}

.speaker-network-empty[hidden] {
  display: none;
}

.speaker-network-empty span {
  max-width: 280px;
}

@media (max-width: 640px) {
  .speaker-network-stage {
    flex-direction: column;
    height: auto;
    min-height: 0;
  }

  .speaker-network-canvas-wrap {
    flex: none;
    height: 360px;
  }

  .speaker-network-panel {
    width: 100%;
    max-height: 240px;
    border-left: none;
    border-top: 1px solid var(--color-border);
  }
}

/* ── Meeting context graph (dashboard + analytics threads) ── */
.graph-link-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: var(--space-3);
  font-size: var(--font-size-xs);
  color: var(--color-text-tertiary);
}

.graph-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.graph-legend-item i {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  font-style: normal;
}

.graph-node-label {
  fill: var(--color-text-secondary);
  font-size: 10px;
  pointer-events: none;
}

.graph-node-shape {
  stroke: rgba(255, 255, 255, 0.35);
  stroke-width: 1.5;
  cursor: pointer;
}

.graph-edge {
  pointer-events: stroke;
}

.graph-panel-block {
  margin-bottom: var(--space-3);
}

.graph-panel-block ul {
  margin: 6px 0 0;
  padding-left: 18px;
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
}

.graph-panel-block strong {
  font-size: var(--font-size-sm);
}

.graph-link-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  font-size: var(--font-size-xs);
  color: var(--color-text-secondary);
}

.graph-link-filter {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  user-select: none;
}

.graph-link-filter input {
  accent-color: var(--color-accent);
}

/* ──────────────────────────────────────────────
   MOBILE REFINEMENTS — все страницы (< 640px)
   ────────────────────────────────────────────── */
@media (max-width: 640px) {
  /* Таблицы: компактные ячейки, крупнее не трогаем */
  .table th,
  .table td {
    padding: 10px 8px;
    font-size: 12px;
  }
  .table th {
    padding: 8px;
    font-size: 10px;
  }
  .table td:first-child,
  .table th:first-child {
    padding-left: 12px;
  }
  .table td:last-child,
  .table th:last-child {
    padding-right: 12px;
  }

  /* Фильтры-чипы: крупнее тач-таргет */
  .filter-chip {
    padding: 8px 14px;
    font-size: 13px;
    min-height: 38px;
  }

  /* Формы фильтров списков: поля на всю ширину */
  .filter-bar .form-group,
  .filter-bar select,
  .filter-bar input[type="text"] {
    min-height: 42px;
    font-size: 14px;
  }
  .filter-bar .form-group {
    width: 100%;
  }

  /* Calendar: компактный месяц */
  .calendar-nav {
    flex-wrap: wrap;
    row-gap: 8px;
  }
  .calendar-nav-arrows {
    gap: 6px;
  }
  .calendar-nav-btn,
  .calendar-today-btn,
  .calendar-mode-btn {
    min-width: 40px;
    min-height: 40px;
    font-size: 13px;
  }
  .calendar-source-filter {
    flex-wrap: wrap;
    gap: 6px;
  }
  .calendar-day-cell {
    min-height: 58px;
    padding: 3px;
  }
  .calendar-day-number {
    margin-bottom: 2px;
  }
  .calendar-day-number a {
    font-size: 12px;
  }
  .calendar-meeting-dot {
    font-size: 10px;
    padding: 1px 3px;
    line-height: 1.6;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
  }
  .calendar-more {
    font-size: 10px;
    padding: 0 3px;
  }
  .calendar-header-cell {
    padding: 6px 2px;
    font-size: 10px;
  }

  /* Calendar: week view — горизонтальный скролл по дням */
  .calendar-week-view {
    grid-template-columns: repeat(7, minmax(140px, 1fr));
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .calendar-week-col {
    min-height: 320px;
  }

  /* Analytics: мелкие таблицы и карточки */
  .mini-table th,
  .mini-table td {
    padding: 6px 8px;
  }
  .overview-grid,
  .stat-cards {
    grid-template-columns: 1fr;
  }

  /* Кнопки действий в таблицах — тач-таргет */
  .action-btn {
    min-width: 38px;
    min-height: 38px;
    font-size: 15px;
  }

  /* Пагинация */
  .pagination {
    flex-wrap: wrap;
    justify-content: center;
  }
}

