/* Zenweb Chat — Design System Tokens & UX Refinements (DESIGN.md v1.0) */
:root {
  --zen-navy-950: #071225;
  --zen-navy-900: #0D1D35;
  --zen-ink: #0A1630;
  --zen-blue-700: #1D4FC4;
  --zen-blue-600: #2D63DC;
  --zen-blue-500: #447FEE;
  --zen-blue-100: #E6EFFF;
  --zen-blue-50: #F1F6FF;
  --zen-page: #F6F8FC;
  --zen-surface: #FFFFFF;
  --zen-surface-soft: #F1F4F9;
  --zen-border: #E2E8F2;
  --zen-text: #18263D;
  --zen-muted: #627087;
  --zen-success: #10B981;
  --zen-warning: #F59E0B;
  --zen-danger: #F46B75;
  --zen-violet: #8B5CF6;
  --zen-emerald: #10B981;
  --zen-amber: #F59E0B;
  --zen-coral: #F46B75;
  --zen-info: #3168E3;
}

html, body {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--zen-page);
  color: var(--zen-text);
  -webkit-font-smoothing: antialiased;
}

/* Subtle custom scrollbars */
.zen-scroll::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
.zen-scroll::-webkit-scrollbar-track {
  background: transparent;
}
.zen-scroll::-webkit-scrollbar-thumb {
  background: #CBD5E1;
  border-radius: 9999px;
}
.zen-scroll::-webkit-scrollbar-thumb:hover {
  background: #94A3B8;
}

/* Focus visibility (WCAG AA) */
:focus-visible {
  outline: 2px solid var(--zen-blue-600);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* Chat canvas & bubbles — Zenweb Chat visual system */
.chat-canvas {
  background-color: #F4F7FB;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='96' viewBox='0 0 96 96'%3E%3Cg fill='none' stroke='%230D1D35' stroke-opacity='0.035' stroke-width='1.35'%3E%3Crect x='14' y='16' width='22' height='15' rx='5'/%3E%3Cpath d='M20 31l-4 4v-4'/%3E%3Ccircle cx='70' cy='25' r='7'/%3E%3Crect x='54' y='58' width='24' height='16' rx='6'/%3E%3Cpath d='M72 74l4 4v-4'/%3E%3Ccircle cx='25' cy='68' r='2' fill='%230D1D35' fill-opacity='0.04' stroke='none'/%3E%3Ccircle cx='47' cy='46' r='1.6' fill='%230D1D35' fill-opacity='0.035' stroke='none'/%3E%3C/g%3E%3C/svg%3E");
  background-repeat: repeat;
}

.chat-bubble-in {
  background-color: #FFFFFF;
  border: 1px solid #E2E8F0;
  color: var(--zen-text);
  box-shadow: 0 1px 2px rgba(7, 18, 37, 0.05);
}

.chat-bubble-out {
  background-color: #E3EEFF;
  border: 1px solid #C8DCFE;
  color: #0F1E36;
  box-shadow: 0 1px 2px rgba(45, 99, 220, 0.07);
}

.chat-bubble-note {
  background-color: #FFFBEB;
  border: 1px solid #FDE68A;
  border-left: 3px solid #D97706;
  color: #5C4309;
  box-shadow: 0 1px 2px rgba(184, 117, 24, 0.06);
}

.zen-msg-text {
  overflow-wrap: anywhere;
  word-break: break-word;
}

#message-timeline-inner {
  width: 100%;
  display: flex;
  flex-direction: column;
}

#message-timeline [data-msg-direction="inbound"] {
  width: 100%;
  justify-content: flex-start;
}

#message-timeline [data-msg-direction="outbound"] {
  width: 100%;
  justify-content: flex-end;
}

#message-timeline [data-msg-direction="internal"] {
  width: 100%;
  justify-content: center;
}

#message-timeline [data-msg-id].hidden,
#message-timeline [data-date-sep].hidden {
  display: none !important;
}

/* Modal & Drawer transitions */
.zen-modal-backdrop {
  background-color: rgba(7, 18, 37, 0.45);
  backdrop-filter: blur(2px);
}

/* Kanban drag feedback */
.kanban-drop-active {
  background-color: var(--zen-blue-50) !important;
  border-color: var(--zen-blue-500) !important;
  box-shadow: inset 0 0 0 2px rgba(45, 99, 220, 0.25);
}

/* Skeleton shimmer */
@keyframes zen-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}
.zen-skeleton {
  animation: zen-pulse 1.6s cubic-bezier(0.4, 0, 0.6, 1) infinite;
  background-color: #E2E8F0;
  border-radius: 0.5rem;
}

/* ============================================================
   Application Shell: Compact Icon-Only Sidebar & Overlay Hover
   ============================================================ */
:root {
  --zen-rail-collapsed: 72px;
  --zen-rail-expanded: 252px;
  --zen-topbar-h: 60px;
}

.zen-sidebar-nav {
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.zen-sidebar-nav::-webkit-scrollbar {
  display: none;
}

@media (min-width: 768px) {
  .zen-rail-spacer {
    width: var(--zen-rail-collapsed);
    flex-shrink: 0;
    transition: width 180ms cubic-bezier(0.2, 0.8, 0.2, 1);
  }
  html[data-sidebar-pinned="true"] .zen-rail-spacer {
    width: var(--zen-rail-expanded);
  }

  .zen-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--zen-rail-collapsed);
    z-index: 35;
    transition: width 180ms cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 180ms ease;
    overflow: hidden;
  }

  .zen-sidebar.is-expanded,
  html[data-sidebar-pinned="true"] .zen-sidebar {
    width: var(--zen-rail-expanded);
  }

  .zen-sidebar.is-expanded:not([data-pinned="true"]) {
    box-shadow: 0 12px 32px rgba(7, 18, 37, 0.12), 0 2px 8px rgba(7, 18, 37, 0.06);
  }

  .zen-sidebar-label,
  .zen-sidebar-brand-text,
  .zen-sidebar-badge-full {
    opacity: 0;
    transform: translateX(-4px);
    transition: opacity 140ms ease, transform 140ms ease;
    pointer-events: none;
    white-space: nowrap;
  }

  .zen-sidebar-group-title {
    height: 0;
    margin-bottom: 0;
    overflow: hidden;
    opacity: 0;
    transition: opacity 140ms ease, height 140ms ease, margin 140ms ease;
    pointer-events: none;
    white-space: nowrap;
  }

  .zen-sidebar.is-expanded .zen-sidebar-label,
  .zen-sidebar.is-expanded .zen-sidebar-brand-text,
  .zen-sidebar.is-expanded .zen-sidebar-badge-full,
  html[data-sidebar-pinned="true"] .zen-sidebar .zen-sidebar-label,
  html[data-sidebar-pinned="true"] .zen-sidebar .zen-sidebar-brand-text,
  html[data-sidebar-pinned="true"] .zen-sidebar .zen-sidebar-badge-full {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
  }

  .zen-sidebar.is-expanded .zen-sidebar-group-title,
  html[data-sidebar-pinned="true"] .zen-sidebar .zen-sidebar-group-title {
    height: 16px;
    margin-bottom: 4px;
    opacity: 1;
  }

  .zen-sidebar.is-expanded .zen-sidebar-dot-badge,
  html[data-sidebar-pinned="true"] .zen-sidebar .zen-sidebar-dot-badge {
    opacity: 0;
  }

  .zen-brand-symbol {
    opacity: 1;
    transform: scale(1);
    transition: opacity 150ms ease, transform 150ms ease;
  }
  .zen-brand-full {
    opacity: 0;
    transform: translateX(-6px);
    transition: opacity 160ms ease, transform 160ms ease;
    pointer-events: none;
  }
  .zen-sidebar.is-expanded .zen-brand-symbol,
  html[data-sidebar-pinned="true"] .zen-sidebar .zen-brand-symbol {
    opacity: 0;
    transform: scale(0.9);
    pointer-events: none;
  }
  .zen-sidebar.is-expanded .zen-brand-full,
  html[data-sidebar-pinned="true"] .zen-sidebar .zen-brand-full {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
  }
}

@media (max-width: 767px) {
  .zen-brand-symbol {
    display: none;
  }
  .zen-brand-full {
    opacity: 1;
  }
}

.zen-nav-item {
  position: relative;
  display: flex;
  align-items: center;
  height: 38px;
  padding: 0 14px;
  border-radius: 10px;
  gap: 12px;
  transition: background-color 140ms ease, color 140ms ease;
}

.zen-nav-item[aria-current="page"] {
  background-color: var(--zen-blue-100);
  color: var(--zen-blue-600);
  font-weight: 600;
}

.zen-nav-item[aria-current="page"]::before {
  content: "";
  position: absolute;
  left: -8px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background-color: var(--zen-blue-600);
}

.zen-app-viewport {
  height: 100vh;
  height: 100dvh;
}
