/* ================================================================
   AGENTIQ PLATFORM
   Intelligent Property Platform - Stylesheet
   ================================================================ */

/* ----------------------------------------------------------------
   CSS CUSTOM PROPERTIES
   ---------------------------------------------------------------- */
:root {
  /* Brand Colors */
  --rw-yellow: #FFE512;
  --rw-yellow-hover: #f0d800;
  --rw-yellow-light: #fff8cc;
  --rw-yellow-glow: rgba(255, 229, 18, 0.25);
  --rw-yellow-subtle: rgba(255, 229, 18, 0.08);
  --rw-black: #080000;
  --rw-white: #FFFFFF;
  --rw-offwhite: #FAF9F2;
  --rw-dark-grey: #595959;

  /* Extended Palette */
  --color-bg-primary: #FAF9F2;
  --color-bg-secondary: #FFFFFF;
  --color-bg-dark: #080000;
  --color-bg-darker: #050000;
  --color-bg-card: #FFFFFF;
  --color-bg-input: #0d0a0a;
  --color-bg-input-light: #f5f4ef;
  --color-text-primary: #1a1a1a;
  --color-text-secondary: #595959;
  --color-text-muted: #8a8a8a;
  --color-text-on-dark: #e0e0e0;
  --color-text-on-yellow: #080000;
  --color-border: #e5e4df;
  --color-border-light: #f0efe9;
  --color-border-dark: #2a2a2a;

  /* Status Colors */
  --color-success: #22c55e;
  --color-success-bg: #f0fdf4;
  --color-error: #ef4444;
  --color-error-bg: #fef2f2;
  --color-info: #3b82f6;
  --color-info-bg: #eff6ff;
  --color-warning: #f59e0b;
  --color-warning-bg: #fffbeb;

  /* Spacing Scale */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --space-3xl: 64px;

  /* Typography */
  --font-heading: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --font-body: 'Lato', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', 'Fira Mono', 'Roboto Mono', monospace;

  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  --text-4xl: 2.25rem;
  --text-5xl: 3rem;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
  --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.2);
  --shadow-yellow: 0 0 20px rgba(255, 229, 18, 0.15);
  --shadow-yellow-lg: 0 0 40px rgba(255, 229, 18, 0.2);

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

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-base: 0.25s ease;
  --transition-slow: 0.35s ease;
  --transition-spring: 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Z-Index Scale */
  --z-sidebar: 100;
  --z-header: 200;
  --z-overlay: 300;
  --z-modal: 400;
  --z-toast: 500;

  /* Layout */
  --sidebar-width: 280px;
  --sidebar-collapsed-width: 72px;
  --header-height: 64px;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: 400;
  line-height: 1.6;
  color: var(--color-text-primary);
  background-color: var(--color-bg-primary);
  overflow-x: hidden;
  min-height: 100vh;
}

/* Selection Colors */
::selection {
  background-color: var(--rw-yellow);
  color: var(--rw-black);
}

::-moz-selection {
  background-color: var(--rw-yellow);
  color: var(--rw-black);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}

::-webkit-scrollbar-track {
  background: var(--color-bg-dark);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb {
  background: var(--rw-yellow);
  border-radius: 10px;
  border: 1px solid var(--color-bg-dark);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--rw-yellow-hover);
}

/* Light area scrollbars */
.main-content::-webkit-scrollbar-track,
.chat-messages::-webkit-scrollbar-track {
  background: var(--color-border-light);
}

.main-content::-webkit-scrollbar-thumb,
.chat-messages::-webkit-scrollbar-thumb {
  background: #c0bfb8;
  border: 1px solid var(--color-border-light);
}

.main-content::-webkit-scrollbar-thumb:hover,
.chat-messages::-webkit-scrollbar-thumb:hover {
  background: #a0a09a;
}

/* Firefox Scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--rw-yellow) var(--color-bg-dark);
}

.main-content,
.chat-messages {
  scrollbar-color: #c0bfb8 var(--color-border-light);
}

/* Screen reader only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Focus Visible */
:focus-visible {
  outline: 2px solid var(--rw-yellow);
  outline-offset: 2px;
}

a {
  color: inherit;
  text-decoration: none;
}

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

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

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

ul, ol {
  list-style: none;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 600;
  line-height: 1.25;
}

[hidden] {
  display: none !important;
}


/* ================================================================
   LOGIN PAGE
   ================================================================ */
.login-page {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #080000 0%, #0f0a1a 40%, #1a1a2e 70%, #10061a 100%);
  z-index: 1000;
  overflow: hidden;
}

/* Subtle animated gradient background */
.login-bg-pattern {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(255, 229, 18, 0.04) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(255, 229, 18, 0.03) 0%, transparent 40%),
    radial-gradient(ellipse at 50% 80%, rgba(26, 26, 46, 0.5) 0%, transparent 60%);
  animation: loginBgShift 12s ease-in-out infinite alternate;
}

@keyframes loginBgShift {
  0% { opacity: 0.7; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.05); }
  100% { opacity: 0.8; transform: scale(1.02); }
}

.login-container {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xl);
  animation: fadeInUp 0.8s ease-out;
  width: 100%;
  max-width: 440px;
  padding: var(--space-lg);
}

/* Glass-morphism Login Card */
.login-card {
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-xl);
  padding: var(--space-2xl) var(--space-xl);
  box-shadow:
    0 32px 64px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  animation: fadeInScale 0.6s ease-out 0.2s both;
}

/* Logo */
.login-logo {
  text-align: center;
  margin-bottom: var(--space-xl);
}

.login-logo-img,
.login-logo-svg {
  width: 90px;
  height: 90px;
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-md);
  box-shadow: var(--shadow-yellow-lg);
  object-fit: cover;
}

.login-brand {
  font-family: var(--font-heading);
  font-size: var(--text-2xl);
  font-weight: 600;
  color: var(--rw-white);
  letter-spacing: 0.5px;
}

.login-brand span {
  color: var(--rw-yellow);
}

.login-subtitle {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 300;
  color: rgba(255, 255, 255, 0.5);
  text-transform: uppercase;
  letter-spacing: 4px;
  margin-top: var(--space-xs);
}

/* Divider */
.login-divider {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.login-divider span {
  flex: 1;
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
}

.login-divider small {
  font-size: var(--text-xs);
  color: rgba(255, 255, 255, 0.35);
  text-transform: uppercase;
  letter-spacing: 2px;
  font-weight: 700;
}

/* Login Form */
.login-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.login-form .form-group {
  display: flex;
  flex-direction: column;
}

.login-form .input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.login-form .input-icon {
  position: absolute;
  left: 14px;
  width: 18px;
  height: 18px;
  color: rgba(255, 255, 255, 0.3);
  pointer-events: none;
  transition: color var(--transition-base);
}

.login-form input[type="text"],
.login-form input[type="password"] {
  width: 100%;
  padding: 14px 14px 14px 44px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  color: var(--rw-white);
  font-size: var(--text-base);
  transition: all var(--transition-base);
}

.login-form input::placeholder {
  color: rgba(255, 255, 255, 0.3);
}

.login-form input:focus {
  outline: none;
  border-color: var(--rw-yellow);
  box-shadow: 0 0 0 3px var(--rw-yellow-glow), 0 0 20px rgba(255, 229, 18, 0.1);
  background: rgba(255, 255, 255, 0.07);
}

.login-form input:focus + .input-icon,
.login-form input:focus ~ .input-icon {
  color: var(--rw-yellow);
}

/* Password Toggle */
.password-toggle {
  position: absolute;
  right: 12px;
  padding: 4px;
  color: rgba(255, 255, 255, 0.3);
  transition: color var(--transition-base);
}

.password-toggle:hover {
  color: var(--rw-yellow);
}

.password-toggle svg,
.password-toggle i {
  width: 18px;
  height: 18px;
}

/* Login Button */
.btn-login {
  width: 100%;
  padding: 14px;
  margin-top: var(--space-sm);
  font-size: var(--text-base);
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

/* Login Error */
.login-error {
  text-align: center;
  color: var(--color-error);
  font-size: var(--text-sm);
  padding: var(--space-sm) var(--space-md);
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: var(--radius-sm);
}

/* Tagline */
.login-tagline {
  text-align: center;
  font-family: var(--font-heading);
  font-style: italic;
  font-size: var(--text-sm);
  color: rgba(255, 255, 255, 0.3);
  margin-top: var(--space-lg);
  letter-spacing: 0.5px;
}

/* Footer */
.login-features {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: var(--space-lg);
  margin-top: var(--space-xl);
  margin-bottom: var(--space-lg);
}

.login-feature {
  display: flex;
  align-items: center;
  gap: 6px;
  color: rgba(255, 255, 255, 0.6);
  font-size: var(--text-sm);
  font-weight: 500;
}

.login-feature i,
.login-feature svg {
  width: 16px;
  height: 16px;
  color: var(--rw-yellow);
}

.login-footer {
  font-size: var(--text-xs);
  color: rgba(255, 255, 255, 0.2);
  letter-spacing: 1px;
}


/* ================================================================
   BUTTONS (Global)
   ================================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 10px 20px;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 600;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all var(--transition-base);
  white-space: nowrap;
  line-height: 1.4;
}

.btn svg,
.btn i {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.btn-primary {
  background: var(--rw-yellow);
  color: var(--rw-black);
  box-shadow: 0 2px 8px rgba(255, 229, 18, 0.2);
}

.btn-primary:hover {
  background: var(--rw-yellow-hover);
  box-shadow: var(--shadow-yellow);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 1px 4px rgba(255, 229, 18, 0.15);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--color-text-secondary);
  border: 1px solid var(--color-border);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: var(--rw-yellow);
  color: var(--color-text-primary);
}

.btn-ghost {
  background: transparent;
  color: var(--color-text-secondary);
  padding: 8px 14px;
}

.btn-ghost:hover {
  background: var(--rw-yellow-subtle);
  color: var(--color-text-primary);
}

.btn-danger {
  background: var(--color-error);
  color: var(--rw-white);
}

.btn-danger:hover {
  background: #dc2626;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
  transform: translateY(-1px);
}

.btn-sm {
  padding: 6px 14px;
  font-size: var(--text-xs);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* Spinner */
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(8, 0, 0, 0.2);
  border-top-color: var(--rw-black);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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


/* ================================================================
   MAIN APP LAYOUT
   ================================================================ */
.app {
  display: flex;
  min-height: 100vh;
  background: var(--color-bg-primary);
}


/* ================================================================
   SIDEBAR
   ================================================================ */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: linear-gradient(180deg, #080000 0%, #0a0508 50%, #0d0a10 100%);
  color: var(--color-text-on-dark);
  display: flex;
  flex-direction: column;
  z-index: var(--z-sidebar);
  transition: width var(--transition-slow);
  overflow: hidden;
  border-right: 1px solid rgba(255, 255, 255, 0.05);
}

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

/* Sidebar Header */
.sidebar-header {
  padding: var(--space-lg) var(--space-md);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  overflow: hidden;
}

.sidebar-logo-img,
.sidebar-logo-svg {
  width: 40px;
  height: 40px;
  min-width: 40px;
  border-radius: var(--radius-sm);
  box-shadow: 0 0 12px rgba(255, 229, 18, 0.15);
  object-fit: cover;
}

.sidebar-brand-text {
  display: flex;
  flex-direction: column;
  white-space: nowrap;
  opacity: 1;
  transition: opacity var(--transition-base);
}

.collapsed .sidebar-brand-text {
  opacity: 0;
  pointer-events: none;
}

.sidebar-brand-name {
  font-family: var(--font-heading);
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--rw-white);
  line-height: 1.2;
}

.sidebar-brand-sub {
  font-size: var(--text-xs);
  color: var(--rw-yellow);
  font-weight: 300;
  letter-spacing: 1px;
  text-transform: uppercase;
}

/* Sidebar User */
.sidebar-user {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  margin: var(--space-sm) var(--space-sm) 0;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.03);
  overflow: hidden;
}

.user-avatar {
  width: 38px;
  height: 38px;
  min-width: 38px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--rw-yellow), #e6cf10);
  color: var(--rw-black);
  font-weight: 700;
  font-size: var(--text-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(255, 229, 18, 0.3);
}

.user-info {
  display: flex;
  flex-direction: column;
  white-space: nowrap;
  opacity: 1;
  transition: opacity var(--transition-base);
}

.collapsed .user-info {
  opacity: 0;
  pointer-events: none;
}

.user-greeting {
  font-size: var(--text-xs);
  color: rgba(255, 255, 255, 0.4);
}

.user-name {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--rw-white);
}

/* Navigation */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: var(--space-md) var(--space-sm);
}

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

.nav-link {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  color: rgba(255, 255, 255, 0.55);
  font-size: var(--text-sm);
  font-weight: 500;
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
  width: 100%;
  text-align: left;
}

.nav-link:hover {
  color: var(--rw-white);
  background: rgba(255, 255, 255, 0.05);
}

.nav-link:hover .nav-icon {
  color: var(--rw-yellow);
}

.nav-item.active > .nav-link {
  color: var(--rw-yellow);
  background: rgba(255, 229, 18, 0.08);
}

.nav-item.active > .nav-link::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3px;
  background: var(--rw-yellow);
  border-radius: 0 3px 3px 0;
  box-shadow: 0 0 8px rgba(255, 229, 18, 0.3);
}

.nav-icon {
  width: 20px;
  height: 20px;
  min-width: 20px;
  transition: color var(--transition-base);
}

.nav-item.active > .nav-link .nav-icon {
  color: var(--rw-yellow);
}

.nav-label {
  white-space: nowrap;
  opacity: 1;
  transition: opacity var(--transition-base);
}

.collapsed .nav-label {
  opacity: 0;
  pointer-events: none;
}

.nav-chevron {
  width: 16px;
  height: 16px;
  margin-left: auto;
  transition: transform var(--transition-base), opacity var(--transition-base);
}

.collapsed .nav-chevron {
  opacity: 0;
}

.nav-toggle[aria-expanded="true"] .nav-chevron {
  transform: rotate(180deg);
}

/* Submenu */
.nav-submenu {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding-left: 20px;
  margin-top: 2px;
  overflow: hidden;
}

.collapsed .nav-submenu {
  padding-left: 0;
}

.nav-submenu .nav-link {
  font-size: var(--text-xs);
  padding: 8px 14px 8px 24px;
  color: rgba(255, 255, 255, 0.4);
}

.nav-submenu .nav-link:hover {
  color: rgba(255, 255, 255, 0.8);
}

.nav-submenu .nav-item.active .nav-link {
  color: var(--rw-yellow);
  background: rgba(255, 229, 18, 0.05);
}

.nav-submenu .nav-icon {
  width: 16px;
  height: 16px;
  min-width: 16px;
}

/* Sidebar Footer */
.sidebar-footer {
  padding: var(--space-sm);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex-shrink: 0;
}

.sidebar-collapse-btn,
.sidebar-logout-btn {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  color: rgba(255, 255, 255, 0.4);
  font-size: var(--text-sm);
  transition: all var(--transition-base);
}

.sidebar-collapse-btn:hover {
  color: var(--rw-white);
  background: rgba(255, 255, 255, 0.05);
}

.sidebar-logout-btn:hover {
  color: var(--color-error);
  background: rgba(239, 68, 68, 0.08);
}

.sidebar-version {
  text-align: center;
  padding: 6px 0 2px;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.15);
  letter-spacing: 0.5px;
}

/* Sidebar Overlay (Mobile) */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: calc(var(--z-sidebar) - 1);
}

/* Mobile Menu Button */
.mobile-menu-btn {
  position: fixed;
  top: var(--space-md);
  left: var(--space-md);
  z-index: calc(var(--z-sidebar) + 1);
  width: 44px;
  height: 44px;
  background: var(--rw-black);
  color: var(--rw-yellow);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(255, 229, 18, 0.15);
}

.mobile-menu-btn svg,
.mobile-menu-btn i {
  width: 22px;
  height: 22px;
}


/* ================================================================
   MAIN CONTENT AREA
   ================================================================ */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left var(--transition-slow);
  background: var(--color-bg-primary);
}

.sidebar.collapsed ~ .main-content,
.sidebar.collapsed ~ * .main-content {
  margin-left: var(--sidebar-collapsed-width);
}

/* View transitions */
.view {
  flex: 1;
  display: flex;
  flex-direction: column;
  animation: fadeIn 0.3s ease-out;
}

.view:not(.view--active):not([hidden]) {
  display: none;
}


/* ================================================================
   DASHBOARD VIEW
   ================================================================ */

/* Hero Banner */
.dashboard-hero {
  position: relative;
  min-height: 220px;
  background: url('https://images.unsplash.com/photo-1600596542815-ffad4c1539a9?w=1600') center/cover no-repeat;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
}

.dashboard-hero-overlay {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(135deg, rgba(8, 0, 0, 0.85) 0%, rgba(8, 0, 0, 0.6) 50%, rgba(8, 0, 0, 0.75) 100%),
    linear-gradient(to top, rgba(8, 0, 0, 0.95) 0%, transparent 60%),
    linear-gradient(45deg, rgba(255, 229, 18, 0.08) 0%, transparent 50%);
}

.dashboard-hero-content {
  position: relative;
  z-index: 2;
  padding: var(--space-2xl) var(--space-2xl) var(--space-xl);
  width: 100%;
}

.dashboard-hero-title {
  font-family: var(--font-heading);
  font-size: var(--text-4xl);
  font-weight: 600;
  color: var(--rw-white);
  margin-bottom: var(--space-sm);
}

.dashboard-hero-title span {
  color: var(--rw-yellow);
}

.dashboard-hero-subtitle {
  font-size: var(--text-lg);
  color: rgba(255, 255, 255, 0.6);
  font-weight: 300;
}

/* Hero Action Buttons */
.dashboard-hero-actions {
  display: flex;
  gap: var(--space-md);
  margin-top: var(--space-lg);
  flex-wrap: wrap;
}

.btn-hero-chat {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 28px;
  background: var(--rw-yellow);
  color: var(--rw-black);
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: 700;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-base);
  box-shadow: var(--shadow-yellow);
}

.btn-hero-chat:hover {
  background: var(--rw-yellow-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-yellow-lg);
}

.btn-hero-chat svg,
.btn-hero-chat i {
  width: 20px;
  height: 20px;
}

.btn-hero-everyday {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 28px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--rw-white);
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-base);
  backdrop-filter: blur(8px);
}

.btn-hero-everyday:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: var(--rw-yellow);
  color: var(--rw-yellow);
  transform: translateY(-2px);
}

.btn-hero-everyday svg,
.btn-hero-everyday i {
  width: 20px;
  height: 20px;
}

/* Privacy & Security Banner */
.privacy-banner {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-2xl);
  background: linear-gradient(90deg, #f0fdf4 0%, #ecfdf5 100%);
  border-bottom: 1px solid #bbf7d0;
}

.privacy-banner-icon {
  width: 36px;
  height: 36px;
  min-width: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #22c55e;
  color: white;
  border-radius: var(--radius-sm);
}

.privacy-banner-icon svg,
.privacy-banner-icon i {
  width: 18px;
  height: 18px;
}

.privacy-banner-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.privacy-banner-content strong {
  font-size: var(--text-sm);
  color: #15803d;
  font-weight: 700;
}

.privacy-banner-content span {
  font-size: var(--text-xs);
  color: #166534;
  line-height: 1.4;
}

/* Login Security Badge */
.login-security {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-full);
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.2);
}

.login-security i,
.login-security svg {
  width: 14px;
  height: 14px;
  color: #22c55e;
}

.login-security span {
  font-size: var(--text-xs);
  color: rgba(255, 255, 255, 0.7);
  font-weight: 400;
}

/* Stats Cards */
.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-lg);
  padding: var(--space-xl) var(--space-2xl);
  margin-top: calc(-1 * var(--space-xl));
  position: relative;
  z-index: 3;
}

.stat-card {
  background: var(--color-bg-card);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  display: flex;
  align-items: center;
  gap: var(--space-md);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--color-border-light);
  transition: all var(--transition-base);
}

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

.stat-icon {
  width: 48px;
  height: 48px;
  min-width: 48px;
  background: var(--rw-yellow-subtle);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--rw-yellow-hover);
}

.stat-icon svg,
.stat-icon i {
  width: 22px;
  height: 22px;
}

.stat-info {
  display: flex;
  flex-direction: column;
}

.stat-number {
  font-family: var(--font-heading);
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--color-text-primary);
  line-height: 1.1;
}

.stat-label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  font-weight: 500;
  margin-top: 2px;
}

/* Dashboard Sections */
.dashboard-section {
  padding: 0 var(--space-2xl) var(--space-xl);
}

.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
}

.section-title {
  font-family: var(--font-heading);
  font-size: var(--text-xl);
  font-weight: 600;
  color: var(--color-text-primary);
}

.section-subtitle {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-left: var(--space-md);
}

.section-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--rw-dark-grey);
  transition: color var(--transition-base);
}

.section-link:hover {
  color: var(--rw-black);
}

.section-link svg,
.section-link i {
  width: 14px;
  height: 14px;
  transition: transform var(--transition-base);
}

.section-link:hover svg,
.section-link:hover i {
  transform: translateX(3px);
}

/* Calculator Cards */
.calculator-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-lg);
}

.calculator-card {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  background: var(--color-bg-card);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  cursor: pointer;
  transition: all var(--transition-base);
}

.calculator-card:hover {
  border-color: var(--rw-yellow);
  box-shadow: 0 4px 16px rgba(255, 229, 18, 0.15);
  transform: translateY(-2px);
}

.calculator-card-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  min-width: 48px;
  border-radius: var(--radius-md);
}

.calculator-card-icon svg,
.calculator-card-icon i {
  width: 24px;
  height: 24px;
}

.calculator-card-icon--blue {
  background: #eff6ff;
  color: #3b82f6;
}

.calculator-card-icon--green {
  background: #f0fdf4;
  color: #22c55e;
}

.calculator-card-icon--amber {
  background: #fffbeb;
  color: #f59e0b;
}

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

.calculator-card-info h4 {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--color-text-primary);
  margin-bottom: 2px;
}

.calculator-card-info p {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: 1.4;
}

.calculator-card-arrow {
  color: var(--color-text-muted);
  transition: all var(--transition-base);
}

.calculator-card-arrow svg,
.calculator-card-arrow i {
  width: 18px;
  height: 18px;
}

.calculator-card:hover .calculator-card-arrow {
  color: var(--rw-yellow-hover);
  transform: translateX(3px);
}

/* Tool Filter Tabs */
.tool-filter-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
}

.tool-filter-tab {
  padding: 6px 16px;
  border: 1px solid var(--color-border);
  border-radius: 100px;
  background: var(--color-bg-card);
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-base);
  white-space: nowrap;
}

.tool-filter-tab:hover {
  border-color: var(--rw-yellow);
  color: var(--color-text-primary);
}

.tool-filter-tab.active {
  background: var(--rw-yellow);
  border-color: var(--rw-yellow);
  color: var(--rw-black);
  font-weight: 600;
}

/* Pro Tips */
.pro-tips-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-md);
}

.pro-tip-card {
  display: flex;
  gap: var(--space-sm);
  padding: var(--space-md);
  background: var(--rw-yellow-subtle);
  border: 1px solid rgba(255, 229, 18, 0.15);
  border-radius: var(--radius-md);
}

.pro-tip-icon {
  color: var(--rw-yellow-hover);
  flex-shrink: 0;
}

.pro-tip-icon svg,
.pro-tip-icon i {
  width: 20px;
  height: 20px;
}

.pro-tip-content strong {
  display: block;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-primary);
  margin-bottom: 2px;
}

.pro-tip-content p {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  line-height: 1.4;
}

/* Tools Grid */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-lg);
}

.tool-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border-light);
  border-left: 4px solid var(--rw-yellow);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  transition: all var(--transition-base);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.tool-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--rw-yellow-subtle) 0%, transparent 60%);
  opacity: 0;
  transition: opacity var(--transition-base);
}

.tool-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-xl);
  border-left-color: var(--rw-yellow);
}

.tool-card:hover::after {
  opacity: 1;
}

.tool-card-icon {
  width: 44px;
  height: 44px;
  background: var(--rw-yellow);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--rw-black);
  position: relative;
  z-index: 1;
}

.tool-card-icon svg,
.tool-card-icon i {
  width: 22px;
  height: 22px;
}

.tool-card-name {
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--color-text-primary);
  position: relative;
  z-index: 1;
}

.tool-card-desc {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: 1.5;
  flex: 1;
  position: relative;
  z-index: 1;
}

.tool-card-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--rw-black);
  padding: 8px 16px;
  background: var(--rw-yellow);
  border-radius: var(--radius-sm);
  align-self: flex-start;
  transition: all var(--transition-base);
  position: relative;
  z-index: 1;
}

.tool-card-btn:hover {
  background: var(--rw-yellow-hover);
  box-shadow: var(--shadow-yellow);
}

.tool-card-btn svg,
.tool-card-btn i {
  width: 14px;
  height: 14px;
}

/* Recent Conversations */
.recent-conversations {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.conversation-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  background: var(--color-bg-card);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-md);
  transition: all var(--transition-base);
  cursor: pointer;
}

.conversation-item:hover {
  border-color: var(--rw-yellow);
  box-shadow: var(--shadow-sm);
  transform: translateX(4px);
}

.conversation-icon {
  width: 36px;
  height: 36px;
  min-width: 36px;
  background: var(--rw-yellow-subtle);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--rw-yellow-hover);
}

.conversation-icon svg,
.conversation-icon i {
  width: 18px;
  height: 18px;
}

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

.conversation-title {
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--color-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conversation-preview {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conversation-time {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  white-space: nowrap;
}

/* Newcastle Banner */
.newcastle-banner {
  margin: var(--space-lg) var(--space-2xl) var(--space-2xl);
  background: var(--color-bg-card);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  position: relative;
}

.newcastle-banner-accent {
  width: 5px;
  min-width: 5px;
  background: var(--rw-yellow);
  flex-shrink: 0;
}

.newcastle-banner-content {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-lg) var(--space-xl);
}

.newcastle-banner-content i,
.newcastle-banner-content svg {
  width: 28px;
  height: 28px;
  min-width: 28px;
  color: var(--rw-yellow-hover);
}

.newcastle-banner-content strong {
  display: block;
  font-family: var(--font-heading);
  font-size: var(--text-base);
  color: var(--color-text-primary);
  margin-bottom: 2px;
}

.newcastle-banner-content span {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}


/* ================================================================
   CHAT VIEW
   ================================================================ */

/* Chat Header */
.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-xl);
  background: var(--color-bg-card);
  border-bottom: 1px solid var(--color-border-light);
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  box-shadow: var(--shadow-xs);
}

.chat-header-info {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.chat-header-icon {
  width: 42px;
  height: 42px;
  background: var(--rw-yellow);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--rw-black);
}

.chat-header-icon svg,
.chat-header-icon i {
  width: 22px;
  height: 22px;
}

.chat-header-title {
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--color-text-primary);
}

.chat-header-desc {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.chat-header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

/* Chat Messages Container */
.chat-messages-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-xl);
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
  scroll-behavior: smooth;
}

/* Empty State */
.chat-empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--space-3xl);
  color: var(--color-text-muted);
}

.chat-empty-icon {
  width: 80px;
  height: 80px;
  background: var(--rw-yellow-subtle);
  border-radius: var(--radius-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-lg);
}

.chat-empty-icon svg,
.chat-empty-icon i {
  width: 36px;
  height: 36px;
  color: var(--rw-yellow-hover);
}

.chat-empty-state h3 {
  font-family: var(--font-heading);
  font-size: var(--text-xl);
  color: var(--color-text-primary);
  margin-bottom: var(--space-sm);
}

.chat-empty-state p {
  max-width: 400px;
  font-size: var(--text-sm);
  line-height: 1.6;
}

/* Message Bubbles */
.chat-message {
  display: flex;
  gap: var(--space-md);
  animation: slideUp 0.3s ease-out;
  max-width: 80%;
}

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

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

.message-avatar {
  width: 34px;
  height: 34px;
  min-width: 34px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 2px;
}

.chat-message--user .message-avatar {
  background: var(--rw-yellow);
  color: var(--rw-black);
}

.chat-message--ai .message-avatar {
  background: var(--rw-black);
  color: var(--rw-yellow);
}

.message-bubble {
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-lg);
  font-size: var(--text-sm);
  line-height: 1.65;
  position: relative;
}

.chat-message--user .message-bubble {
  background: linear-gradient(135deg, #fff9db 0%, #fff5c0 100%);
  border: 1px solid rgba(255, 229, 18, 0.2);
  border-bottom-right-radius: var(--radius-sm);
  color: var(--color-text-primary);
}

.chat-message--ai .message-bubble {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border-light);
  border-bottom-left-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  color: var(--color-text-primary);
}

/* Markdown content inside AI messages */
.message-bubble h1,
.message-bubble h2,
.message-bubble h3,
.message-bubble h4 {
  font-family: var(--font-heading);
  margin-top: var(--space-md);
  margin-bottom: var(--space-sm);
}

.message-bubble h1 { font-size: var(--text-xl); }
.message-bubble h2 { font-size: var(--text-lg); }
.message-bubble h3 { font-size: var(--text-base); }

.message-bubble p {
  margin-bottom: var(--space-sm);
}

.message-bubble p:last-child {
  margin-bottom: 0;
}

.message-bubble ul,
.message-bubble ol {
  margin: var(--space-sm) 0;
  padding-left: var(--space-lg);
}

.message-bubble ul { list-style: disc; }
.message-bubble ol { list-style: decimal; }

.message-bubble li {
  margin-bottom: 4px;
}

.message-bubble strong {
  font-weight: 700;
}

.message-bubble em {
  font-style: italic;
}

.message-bubble a {
  color: var(--color-info);
  text-decoration: underline;
}

/* Code blocks in messages */
.message-bubble code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: rgba(0, 0, 0, 0.06);
  padding: 2px 6px;
  border-radius: 4px;
}

.message-bubble pre {
  background: #1e1e2e;
  color: #cdd6f4;
  padding: var(--space-md);
  border-radius: var(--radius-md);
  overflow-x: auto;
  margin: var(--space-sm) 0;
  font-size: var(--text-xs);
  line-height: 1.6;
}

.message-bubble pre code {
  background: none;
  padding: 0;
  color: inherit;
  font-size: inherit;
}

/* Message timestamp */
.message-time {
  font-size: 11px;
  color: var(--color-text-muted);
  margin-top: 4px;
  opacity: 0;
  transition: opacity var(--transition-base);
}

.chat-message:hover .message-time {
  opacity: 1;
}

.chat-message--user .message-time {
  text-align: right;
}

/* Typing Indicator */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-sm) var(--space-xl);
  animation: fadeIn 0.3s ease-out;
}

.typing-avatar {
  width: 30px;
  height: 30px;
  min-width: 30px;
  border-radius: var(--radius-full);
  background: var(--rw-black);
  color: var(--rw-yellow);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
}

.typing-dots {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 16px;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  border-bottom-left-radius: var(--radius-sm);
}

.typing-dots span {
  display: block;
  width: 7px;
  height: 7px;
  background: var(--color-text-muted);
  border-radius: var(--radius-full);
  animation: typingBounce 1.4s ease-in-out infinite;
}

.typing-dots span:nth-child(2) {
  animation-delay: 0.15s;
}

.typing-dots span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes typingBounce {
  0%, 60%, 100% {
    transform: translateY(0);
    opacity: 0.4;
  }
  30% {
    transform: translateY(-6px);
    opacity: 1;
    background: var(--rw-yellow);
  }
}

.typing-text {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  font-style: italic;
}

/* Chat Input Area */
.chat-input-area {
  padding: var(--space-md) var(--space-xl) var(--space-lg);
  background: var(--color-bg-primary);
  border-top: 1px solid var(--color-border-light);
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.03);
  position: sticky;
  bottom: 0;
}

.chat-input-hint {
  text-align: center;
  padding-top: 6px;
  font-size: 11px;
  color: var(--color-text-muted);
  opacity: 0.7;
}

.chat-input-hint kbd {
  display: inline-block;
  padding: 1px 5px;
  font-size: 10px;
  font-family: var(--font-mono, monospace);
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: 3px;
  box-shadow: 0 1px 0 var(--color-border);
}

.chat-input-container {
  display: flex;
  align-items: flex-end;
  gap: var(--space-md);
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-sm) var(--space-md);
  transition: border-color var(--transition-base), box-shadow var(--transition-base);
}

.chat-input-container:focus-within {
  border-color: var(--rw-yellow);
  box-shadow: 0 0 0 3px var(--rw-yellow-glow);
}

.chat-textarea {
  flex: 1;
  resize: none;
  border: none;
  outline: none;
  background: transparent;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  line-height: 1.5;
  padding: var(--space-sm) 0;
  max-height: 150px;
  overflow-y: auto;
  color: var(--color-text-primary);
}

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

.chat-input-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding-bottom: var(--space-xs);
}

.char-count {
  font-size: 11px;
  color: var(--color-text-muted);
  white-space: nowrap;
}

.btn-send {
  width: 38px;
  height: 38px;
  min-width: 38px;
  border-radius: var(--radius-full);
  background: var(--rw-yellow);
  color: var(--rw-black);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-base);
  padding: 0;
}

.btn-send:hover:not(:disabled) {
  background: var(--rw-yellow-hover);
  box-shadow: var(--shadow-yellow);
  transform: scale(1.05);
}

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

.btn-send svg,
.btn-send i {
  width: 18px;
  height: 18px;
}


/* ================================================================
   DOCUMENT ATTACH BUTTON & CHIPS
   ================================================================ */

.btn-attach {
  width: 38px;
  height: 38px;
  min-width: 38px;
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-base);
  padding: 0;
  border: 1px solid var(--color-border);
  cursor: pointer;
  flex-shrink: 0;
}

.btn-attach:hover {
  color: var(--rw-yellow);
  border-color: var(--rw-yellow);
  background: rgba(254, 219, 0, 0.08);
}

.btn-attach svg,
.btn-attach i {
  width: 18px;
  height: 18px;
}

/* Attached documents container */
.attached-documents {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 0 10px 0;
}

/* Document chip */
.doc-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 6px 10px;
  font-size: 13px;
  transition: all var(--transition-base);
  max-width: 260px;
}

.doc-chip:hover {
  border-color: var(--rw-yellow);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.doc-chip--uploading {
  opacity: 0.65;
  border-style: dashed;
}

.doc-chip-icon {
  width: 16px;
  height: 16px;
  color: var(--rw-yellow);
  flex-shrink: 0;
}

.doc-chip-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 1px;
}

.doc-chip-name {
  font-weight: 600;
  color: var(--color-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 12px;
  max-width: 160px;
}

.doc-chip-size {
  font-size: 10px;
  color: var(--color-text-muted);
}

.doc-chip-remove {
  width: 20px;
  height: 20px;
  min-width: 20px;
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: none;
  padding: 0;
  transition: all var(--transition-base);
  flex-shrink: 0;
}

.doc-chip-remove:hover {
  background: rgba(220, 38, 38, 0.1);
  color: #dc2626;
}

.doc-chip-remove svg,
.doc-chip-remove i {
  width: 14px;
  height: 14px;
}

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

.spinner--small {
  width: 14px;
  height: 14px;
  border: 2px solid var(--color-border);
  border-top-color: var(--rw-yellow);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

/* Drag and drop overlay */
.chat-input-area {
  position: relative;
}

.drop-overlay {
  position: absolute;
  inset: 0;
  background: rgba(254, 219, 0, 0.08);
  border: 2px dashed var(--rw-yellow);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  backdrop-filter: blur(4px);
}

.drop-overlay-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--rw-yellow);
  text-align: center;
}

.drop-overlay-content i,
.drop-overlay-content svg {
  width: 32px;
  height: 32px;
}

.drop-overlay-content span {
  font-weight: 700;
  font-size: 15px;
}

.drop-overlay-content small {
  font-size: 12px;
  color: var(--color-text-muted);
}


/* ================================================================
   CHAT HISTORY VIEW
   ================================================================ */
.view-header {
  padding: var(--space-xl) var(--space-2xl);
  border-bottom: 1px solid var(--color-border-light);
  background: var(--color-bg-card);
}

.view-title {
  font-family: var(--font-heading);
  font-size: var(--text-3xl);
  font-weight: 600;
  color: var(--color-text-primary);
}

.view-subtitle {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-top: var(--space-xs);
}

/* Search Bar */
.history-search {
  padding: var(--space-lg) var(--space-2xl);
}

.search-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 14px;
  width: 18px;
  height: 18px;
  color: var(--color-text-muted);
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 12px 40px 12px 44px;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  font-size: var(--text-sm);
  color: var(--color-text-primary);
  transition: all var(--transition-base);
}

.search-input:focus {
  outline: none;
  border-color: var(--rw-yellow);
  box-shadow: 0 0 0 3px var(--rw-yellow-glow);
}

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

.search-clear {
  position: absolute;
  right: 10px;
  padding: 4px;
  color: var(--color-text-muted);
  border-radius: var(--radius-full);
  transition: all var(--transition-base);
}

.search-clear:hover {
  color: var(--color-text-primary);
  background: var(--color-border-light);
}

.search-clear svg,
.search-clear i {
  width: 16px;
  height: 16px;
}

/* History List */
.history-list {
  padding: 0 var(--space-2xl) var(--space-2xl);
}

.history-date-group {
  margin-bottom: var(--space-lg);
}

.history-date-label {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--color-text-muted);
  padding: var(--space-sm) 0;
  margin-bottom: var(--space-sm);
  border-bottom: 1px solid var(--color-border-light);
}

.history-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-md);
  transition: all var(--transition-base);
  cursor: pointer;
  position: relative;
}

.history-item:hover {
  background: var(--color-bg-card);
  box-shadow: var(--shadow-sm);
}

.history-item-icon {
  width: 36px;
  height: 36px;
  min-width: 36px;
  background: var(--rw-yellow-subtle);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--rw-yellow-hover);
}

.history-item-icon svg,
.history-item-icon i {
  width: 18px;
  height: 18px;
}

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

.history-item-title {
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--color-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-item-preview {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.history-item-time {
  font-size: 11px;
  color: var(--color-text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.history-item-delete {
  opacity: 0;
  padding: 6px;
  color: var(--color-text-muted);
  border-radius: var(--radius-sm);
  transition: all var(--transition-base);
  flex-shrink: 0;
}

.history-item:hover .history-item-delete {
  opacity: 1;
}

.history-item-delete:hover {
  color: var(--color-error);
  background: var(--color-error-bg);
}

.history-item-delete svg,
.history-item-delete i {
  width: 15px;
  height: 15px;
}


/* ================================================================
   ADMIN SETTINGS VIEW
   ================================================================ */
.admin-panels {
  padding: var(--space-xl) var(--space-2xl) var(--space-2xl);
  display: flex;
  flex-direction: column;
  gap: var(--space-xl);
}

.admin-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.admin-card-header {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-lg) var(--space-xl);
  border-bottom: 1px solid var(--color-border-light);
  background: var(--color-bg-primary);
}

.admin-card-header svg,
.admin-card-header i {
  width: 20px;
  height: 20px;
  color: var(--rw-yellow-hover);
}

.admin-card-header h3 {
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--color-text-primary);
  flex: 1;
}

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

/* Admin Form Groups */
.admin-card .form-group {
  margin-bottom: var(--space-lg);
}

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

.admin-card label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-primary);
  margin-bottom: var(--space-sm);
}

.form-input,
.form-select {
  width: 100%;
  padding: 12px 16px;
  background: var(--color-bg-input-light);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  color: var(--color-text-primary);
  transition: all var(--transition-base);
}

.form-input:focus,
.form-select:focus {
  outline: none;
  border-color: var(--rw-yellow);
  box-shadow: 0 0 0 3px var(--rw-yellow-glow);
  background: var(--rw-white);
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23595959' 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 12px center;
  padding-right: 40px;
}

.admin-card .input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.admin-card .input-wrapper .form-input {
  padding-right: 44px;
}

.admin-card .password-toggle {
  position: absolute;
  right: 12px;
  padding: 4px;
  color: var(--color-text-muted);
  transition: color var(--transition-base);
}

.admin-card .password-toggle:hover {
  color: var(--rw-yellow-hover);
}

.admin-card .password-toggle svg,
.admin-card .password-toggle i {
  width: 18px;
  height: 18px;
}

/* Model Selector Row */
.model-selector-row {
  display: flex;
  gap: var(--space-sm);
  align-items: stretch;
}

.model-selector-row .form-select {
  flex: 1;
  min-width: 0;
}

.btn-fetch-models {
  white-space: nowrap;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  font-size: var(--text-sm);
}

.btn-fetch-models .spinner {
  width: 16px;
  height: 16px;
}

/* Form Actions */
.form-actions {
  display: flex;
  gap: var(--space-md);
  flex-wrap: wrap;
}

/* Test Result */
.test-result {
  margin-top: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.test-result.success {
  background: var(--color-success-bg);
  color: #15803d;
  border: 1px solid rgba(34, 197, 94, 0.2);
}

.test-result.error {
  background: var(--color-error-bg);
  color: #b91c1c;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

/* Users Table */
.table-wrapper {
  overflow-x: auto;
}

.users-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.users-table th {
  text-align: left;
  padding: var(--space-md) var(--space-lg);
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--color-text-muted);
  border-bottom: 2px solid var(--color-border);
  white-space: nowrap;
}

.users-table td {
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--color-border-light);
  color: var(--color-text-primary);
  vertical-align: middle;
}

.users-table tbody tr {
  transition: background-color var(--transition-base);
}

.users-table tbody tr:nth-child(even) {
  background: rgba(250, 249, 242, 0.5);
}

.users-table tbody tr:hover {
  background: var(--rw-yellow-subtle);
}

/* Role Badges */
.role-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.role-badge--admin {
  background: var(--rw-yellow);
  color: var(--rw-black);
}

.role-badge--agent {
  background: #e8e8e8;
  color: var(--rw-dark-grey);
}

/* System Info Grid */
.system-info-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-md);
}

.info-item {
  padding: var(--space-md);
  background: var(--color-bg-primary);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border-light);
}

.info-label {
  display: block;
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-text-muted);
  margin-bottom: 4px;
}

.info-value {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-primary);
}

/* Status Dots */
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
}

.status-dot--online {
  background: var(--color-success);
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.4);
}

.status-dot--offline {
  background: var(--color-error);
}

.status-dot--unknown {
  background: var(--color-text-muted);
}


/* ================================================================
   MODALS
   ================================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal);
  padding: var(--space-lg);
  animation: fadeIn 0.2s ease-out;
}

.modal-overlay.active {
  display: flex;
}

.modal-card {
  width: 100%;
  max-width: 520px;
  background: var(--color-bg-card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-2xl);
  overflow: hidden;
  animation: modalEnter 0.3s ease-out;
}

.modal-card--sm {
  max-width: 420px;
}

@keyframes modalEnter {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

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

.modal-header h3 {
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--color-text-primary);
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
  transition: all var(--transition-base);
}

.modal-close:hover {
  background: var(--color-border-light);
  color: var(--color-text-primary);
}

.modal-close svg,
.modal-close i {
  width: 18px;
  height: 18px;
}

.modal-body {
  padding: var(--space-xl);
}

.modal-body .form-group {
  margin-bottom: var(--space-lg);
}

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

.modal-body label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-primary);
  margin-bottom: var(--space-sm);
}

.modal-warning {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  padding: var(--space-lg);
  background: var(--color-warning-bg);
  border: 1px solid rgba(245, 158, 11, 0.2);
  border-radius: var(--radius-md);
}

.modal-warning svg,
.modal-warning i {
  width: 22px;
  height: 22px;
  min-width: 22px;
  color: var(--color-warning);
}

.modal-warning p {
  font-size: var(--text-sm);
  color: #92400e;
  line-height: 1.5;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-xl);
  border-top: 1px solid var(--color-border-light);
  background: var(--color-bg-primary);
}


/* ================================================================
   TOAST NOTIFICATIONS
   ================================================================ */
.toast-container {
  position: fixed;
  top: var(--space-lg);
  right: var(--space-lg);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  pointer-events: none;
  max-width: 400px;
  width: 100%;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  background: var(--color-bg-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--color-border-light);
  pointer-events: auto;
  animation: slideInRight 0.35s ease-out;
  position: relative;
  overflow: hidden;
}

.toast::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
}

.toast--success::before { background: var(--color-success); }
.toast--error::before { background: var(--color-error); }
.toast--info::before { background: var(--color-info); }

.toast-icon {
  width: 20px;
  height: 20px;
  min-width: 20px;
  margin-top: 1px;
}

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

.toast-content {
  flex: 1;
}

.toast-title {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--color-text-primary);
  line-height: 1.3;
}

.toast-message {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-top: 2px;
  line-height: 1.4;
}

.toast-close {
  padding: 2px;
  color: var(--color-text-muted);
  border-radius: var(--radius-sm);
  transition: all var(--transition-base);
  flex-shrink: 0;
}

.toast-close:hover {
  color: var(--color-text-primary);
  background: var(--color-border-light);
}

.toast-close svg,
.toast-close i {
  width: 14px;
  height: 14px;
}

/* Toast progress bar */
.toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  border-radius: 0 0 0 var(--radius-md);
  animation: toastProgress linear forwards;
}

.toast--success .toast-progress { background: var(--color-success); }
.toast--error .toast-progress { background: var(--color-error); }
.toast--info .toast-progress { background: var(--color-info); }

@keyframes toastProgress {
  from { width: 100%; }
  to { width: 0%; }
}

.toast.toast--exit {
  animation: slideOutRight 0.3s ease-in forwards;
}


/* ================================================================
   EMPTY STATES
   ================================================================ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--space-3xl) var(--space-xl);
  color: var(--color-text-muted);
}

.empty-state svg,
.empty-state i {
  width: 48px;
  height: 48px;
  margin-bottom: var(--space-md);
  opacity: 0.3;
}

.empty-state h3 {
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-sm);
}

.empty-state p {
  font-size: var(--text-sm);
  max-width: 360px;
  margin-bottom: var(--space-lg);
}

.empty-state--small {
  padding: var(--space-xl);
}

.empty-state--small svg,
.empty-state--small i {
  width: 32px;
  height: 32px;
}


/* ================================================================
   APP FOOTER
   ================================================================ */
.app-footer {
  padding: var(--space-lg) var(--space-2xl);
  text-align: center;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  border-top: 1px solid var(--color-border-light);
  margin-top: auto;
}


/* ================================================================
   KEYFRAME ANIMATIONS
   ================================================================ */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.96);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

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

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

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

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

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* Shimmer loading effect */
.shimmer {
  background: linear-gradient(
    90deg,
    var(--color-border-light) 25%,
    var(--color-bg-card) 37%,
    var(--color-border-light) 63%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
}


/* ================================================================
   RESPONSIVE DESIGN
   ================================================================ */

/* Large Desktop (1400px+) */
@media (min-width: 1400px) {
  .tools-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .system-info-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Desktop (1024px - 1399px) */
@media (max-width: 1399px) {
  .tools-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Tablet (768px - 1023px) */
@media (max-width: 1023px) {
  .sidebar {
    width: var(--sidebar-collapsed-width);
  }

  .sidebar .sidebar-brand-text,
  .sidebar .user-info,
  .sidebar .nav-label,
  .sidebar .nav-chevron {
    opacity: 0;
    pointer-events: none;
  }

  .sidebar .nav-submenu {
    padding-left: 0;
  }

  .main-content {
    margin-left: var(--sidebar-collapsed-width);
  }

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

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

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

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

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

  .dashboard-hero-title {
    font-size: var(--text-3xl);
  }
}

/* Mobile (< 768px) */
@media (max-width: 767px) {
  :root {
    --sidebar-width: 280px;
  }

  /* Sidebar becomes off-canvas drawer */
  .sidebar {
    width: var(--sidebar-width);
    transform: translateX(-100%);
    transition: transform var(--transition-slow);
    box-shadow: none;
  }

  .sidebar.mobile-open {
    transform: translateX(0);
    box-shadow: var(--shadow-2xl);
  }

  /* Restore labels in mobile drawer */
  .sidebar.mobile-open .sidebar-brand-text,
  .sidebar.mobile-open .user-info,
  .sidebar.mobile-open .nav-label,
  .sidebar.mobile-open .nav-chevron {
    opacity: 1;
    pointer-events: auto;
  }

  .main-content {
    margin-left: 0;
  }

  .mobile-menu-btn {
    display: flex !important;
  }

  /* Dashboard */
  .dashboard-hero {
    min-height: 180px;
  }

  .dashboard-hero-content {
    padding: var(--space-xl) var(--space-lg) var(--space-lg);
    padding-top: 60px; /* Space for hamburger */
  }

  .dashboard-hero-title {
    font-size: var(--text-2xl);
  }

  .dashboard-hero-subtitle {
    font-size: var(--text-sm);
  }

  .dashboard-stats {
    grid-template-columns: repeat(2, 1fr);
    padding: var(--space-lg);
    gap: var(--space-md);
    margin-top: -12px;
  }

  .stat-card {
    padding: var(--space-md);
  }

  .stat-icon {
    width: 40px;
    height: 40px;
    min-width: 40px;
  }

  .stat-number {
    font-size: var(--text-xl);
  }

  .tools-grid {
    grid-template-columns: 1fr;
    gap: var(--space-md);
  }

  .calculator-cards {
    grid-template-columns: 1fr;
    gap: var(--space-md);
  }

  .pro-tips-grid {
    grid-template-columns: 1fr 1fr;
  }

  .dashboard-section {
    padding: 0 var(--space-lg) var(--space-lg);
  }

  .newcastle-banner {
    margin: var(--space-md) var(--space-lg) var(--space-xl);
  }

  /* Chat */
  .chat-header {
    padding: var(--space-md);
    padding-left: 60px; /* Space for hamburger */
  }

  .chat-header-actions span {
    display: none;
  }

  .chat-messages {
    padding: var(--space-md);
  }

  .chat-message {
    max-width: 92%;
  }

  .chat-input-area {
    padding: var(--space-sm) var(--space-md) var(--space-md);
  }

  /* History */
  .view-header {
    padding: var(--space-lg);
    padding-top: 60px; /* Space for hamburger */
  }

  .view-title {
    font-size: var(--text-2xl);
  }

  .history-search {
    padding: var(--space-md) var(--space-lg);
  }

  .history-list {
    padding: 0 var(--space-lg) var(--space-lg);
  }

  /* Admin */
  .admin-panels {
    padding: var(--space-md) var(--space-lg) var(--space-lg);
  }

  .admin-card-header {
    padding: var(--space-md);
  }

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

  .system-info-grid {
    grid-template-columns: 1fr;
  }

  .form-actions {
    flex-direction: column;
  }

  .form-actions .btn {
    width: 100%;
    justify-content: center;
  }

  /* Users table responsive */
  .users-table th,
  .users-table td {
    padding: var(--space-sm) var(--space-md);
    font-size: var(--text-xs);
  }

  /* Modals */
  .modal-overlay {
    padding: var(--space-md);
    align-items: flex-end;
  }

  .modal-card {
    max-width: 100%;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  }

  /* Toast */
  .toast-container {
    right: var(--space-md);
    left: var(--space-md);
    max-width: none;
  }
}

/* Very Small Mobile (< 400px) */
@media (max-width: 399px) {
  .dashboard-stats {
    grid-template-columns: 1fr;
  }

  .chat-message {
    max-width: 96%;
  }

  .login-card {
    padding: var(--space-xl) var(--space-lg);
  }

  .login-logo-img,
  .login-logo-svg {
    width: 70px;
    height: 70px;
  }
}


/* ================================================================
   SPECIAL TOUCHES & UTILITY CLASSES
   ================================================================ */

/* Focus glow effect */
.focus-glow:focus,
input:focus,
textarea:focus,
select:focus {
  transition: border-color var(--transition-base), box-shadow var(--transition-base);
}

/* Hover lift class */
.hover-lift {
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.hover-lift:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

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

/* Visually Hidden but focusable */
.visually-hidden:not(:focus):not(:active) {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Loading Button State */
.btn.loading .btn-text {
  visibility: hidden;
}

.btn.loading .btn-loader {
  display: flex !important;
  position: absolute;
}

/* Gradient text */
.gradient-text {
  background: linear-gradient(135deg, var(--rw-yellow), #ffd700, var(--rw-yellow));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Yellow underline accent */
.accent-underline {
  position: relative;
  display: inline-block;
}

.accent-underline::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--rw-yellow);
  border-radius: 2px;
}

/* Animated yellow border glow */
@keyframes borderGlow {
  0%, 100% {
    border-color: rgba(255, 229, 18, 0.2);
    box-shadow: 0 0 8px rgba(255, 229, 18, 0.05);
  }
  50% {
    border-color: rgba(255, 229, 18, 0.5);
    box-shadow: 0 0 16px rgba(255, 229, 18, 0.15);
  }
}

/* No-select */
.no-select {
  user-select: none;
  -webkit-user-select: none;
}

/* Transition helpers */
.transition-all {
  transition: all var(--transition-base);
}

.transition-colors {
  transition: color var(--transition-base), background-color var(--transition-base), border-color var(--transition-base);
}

/* Opacity variants */
.opacity-0 { opacity: 0; }
.opacity-50 { opacity: 0.5; }
.opacity-100 { opacity: 1; }

/* Text alignment */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

/* Flex utilities */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }


/* ================================================================
   MODULE MANAGEMENT
   ================================================================ */
.modules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-md);
}

.module-card {
  position: relative;
  background: var(--color-bg-primary);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  transition: all var(--transition-base);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.module-card:hover {
  border-color: var(--rw-yellow);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.module-card-header {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.module-card-icon {
  width: 42px;
  height: 42px;
  min-width: 42px;
  background: var(--rw-yellow-subtle);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--rw-yellow-hover);
}

.module-card-icon svg,
.module-card-icon i {
  width: 20px;
  height: 20px;
}

.module-card-title {
  font-family: var(--font-heading);
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--color-text-primary);
  line-height: 1.3;
}

.module-card-category {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--rw-yellow-hover);
}

.module-card-desc {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: 1.5;
  flex: 1;
}

.module-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: var(--space-sm);
  border-top: 1px solid var(--color-border-light);
  margin-top: var(--space-sm);
}

.module-card-price {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--color-text-primary);
}

.module-card-price small {
  font-size: var(--text-xs);
  font-weight: 400;
  color: var(--color-text-muted);
}

.module-card-tools {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.module-card-actions {
  position: absolute;
  top: var(--space-sm);
  right: var(--space-sm);
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity var(--transition-base);
}

.module-card:hover .module-card-actions {
  opacity: 1;
}

.module-card-actions button {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
  transition: all var(--transition-base);
}

.module-card-actions button:hover {
  background: var(--color-border-light);
  color: var(--color-text-primary);
}

.module-card-actions button svg,
.module-card-actions button i {
  width: 14px;
  height: 14px;
}

/* User Module Assignment */
.user-modules-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--space-md);
}

.user-module-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  background: var(--color-bg-primary);
  border: 2px solid var(--color-border-light);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-base);
}

.user-module-toggle:hover {
  border-color: var(--rw-yellow);
}

.user-module-toggle.active {
  border-color: var(--rw-yellow);
  background: var(--rw-yellow-subtle);
}

.user-module-toggle-check {
  width: 24px;
  height: 24px;
  min-width: 24px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-base);
  color: transparent;
}

.user-module-toggle.active .user-module-toggle-check {
  background: var(--rw-yellow);
  border-color: var(--rw-yellow);
  color: var(--rw-black);
}

.user-module-toggle-check svg,
.user-module-toggle-check i {
  width: 14px;
  height: 14px;
}

.user-module-toggle-info {
  flex: 1;
  min-width: 0;
}

.user-module-toggle-name {
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--color-text-primary);
}

.user-module-toggle-price {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

/* Module inactive badge */
.module-badge-inactive {
  display: inline-flex;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  background: var(--color-error-bg);
  color: #b91c1c;
}

/* ================================================================
   CHAT MESSAGE BUBBLES (Dynamic)
   ================================================================ */
.message-wrapper {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  max-width: 100%;
}

.message-wrapper.user-message {
  flex-direction: row-reverse;
  justify-content: flex-start;
}

.message-wrapper.ai-message {
  flex-direction: row;
}

.message-bubble.user {
  background: linear-gradient(135deg, #FFF9E0 0%, #fff5c0 100%);
  border: 1px solid rgba(255, 229, 18, 0.2);
  border-radius: var(--radius-lg);
  border-bottom-right-radius: var(--radius-sm);
  color: var(--color-text-primary);
}

.message-bubble.assistant {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  border-bottom-left-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  color: var(--color-text-primary);
}

.message-avatar {
  width: 34px;
  height: 34px;
  min-width: 34px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 2px;
  background: var(--rw-black);
  color: var(--rw-yellow);
}

.message-avatar svg,
.message-avatar i {
  width: 18px;
  height: 18px;
}

.message-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

/* ── AI Message Content — Professional Markdown Rendering ── */
.message-content {
  font-size: 0.9rem;
  line-height: 1.75;
  word-wrap: break-word;
  overflow-wrap: break-word;
  color: var(--color-text-primary);
}

.message-content > *:first-child {
  margin-top: 0;
}

.message-content > *:last-child {
  margin-bottom: 0;
}

.message-content p,
.message-content li,
.message-content span,
.message-content td,
.message-content th {
  color: var(--color-text-primary);
}

/* Headings — clear visual hierarchy */
.message-content h1 {
  color: var(--color-text-primary);
  font-weight: 700;
  font-size: 1.4em;
  margin: 1.2em 0 0.5em 0;
  padding-bottom: 0.3em;
  border-bottom: 2px solid var(--rw-yellow);
}

.message-content h2 {
  color: var(--color-text-primary);
  font-weight: 700;
  font-size: 1.2em;
  margin: 1.1em 0 0.4em 0;
  padding-bottom: 0.2em;
  border-bottom: 1px solid var(--color-border);
}

.message-content h3 {
  color: var(--color-text-primary);
  font-weight: 600;
  font-size: 1.05em;
  margin: 1em 0 0.35em 0;
}

.message-content h4,
.message-content h5,
.message-content h6 {
  color: var(--color-text-primary);
  font-weight: 600;
  font-size: 0.95em;
  margin: 0.8em 0 0.3em 0;
}

/* Bold and emphasis */
.message-content strong {
  color: var(--color-text-primary);
  font-weight: 700;
}

.message-content em {
  font-style: italic;
}

/* Lists — clean, well-spaced, professional */
.message-content ul,
.message-content ol {
  padding-left: 1.6em;
  margin: 0.6em 0;
}

.message-content ul {
  list-style-type: disc;
}

.message-content ol {
  list-style-type: decimal;
}

.message-content li {
  display: list-item;
  margin-bottom: 0.4em;
  padding-left: 0.3em;
  line-height: 1.7;
}

.message-content li > ul,
.message-content li > ol {
  margin-top: 0.3em;
  margin-bottom: 0.2em;
}

.message-content li > p {
  margin: 0.2em 0;
}

/* Paragraphs — good breathing room */
.message-content p {
  margin: 0.6em 0;
}

/* Inline code */
.message-content code {
  background: rgba(0, 0, 0, 0.07);
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 0.88em;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  color: #1a1a1a;
}

/* Code blocks */
.message-content pre {
  background: #1e1e2e;
  color: #e0e0e0;
  padding: 1em 1.2em;
  border-radius: var(--radius-md);
  overflow-x: auto;
  margin: 0.8em 0;
  font-size: 0.85em;
  line-height: 1.6;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.message-content pre code {
  background: none;
  padding: 0;
  color: inherit;
  font-size: inherit;
  border-radius: 0;
}

/* Blockquotes — elegant left accent */
.message-content blockquote {
  border-left: 3px solid var(--rw-yellow);
  padding: 0.5em 1em;
  margin: 0.8em 0;
  background: rgba(0, 0, 0, 0.02);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--color-text-secondary);
}

.message-content blockquote p {
  margin: 0.3em 0;
}

/* Tables — clean professional look */
.message-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.8em 0;
  font-size: 0.88em;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--color-border);
}

.message-content th,
.message-content td {
  border: 1px solid var(--color-border);
  padding: 8px 12px;
  text-align: left;
  vertical-align: top;
}

.message-content th {
  background: var(--color-bg-primary);
  font-weight: 700;
  font-size: 0.9em;
  text-transform: none;
  letter-spacing: 0;
}

.message-content tr:nth-child(even) {
  background: rgba(0, 0, 0, 0.015);
}

/* Horizontal rules */
.message-content hr {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: 1.2em 0;
}

/* Links */
.message-content a {
  color: #3b82f6;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.message-content a:hover {
  color: #2563eb;
}

/* Numbered steps and key-value formatting */
.message-content ol > li::marker {
  font-weight: 700;
  color: var(--rw-yellow);
}

.message-footer {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-top: var(--space-xs);
  opacity: 0;
  transition: opacity var(--transition-base);
}

.message-bubble:hover .message-footer {
  opacity: 1;
}

.message-time {
  font-size: 11px;
  color: var(--color-text-muted);
}

.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-muted);
  background: transparent;
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-base);
  white-space: nowrap;
}

.copy-btn:hover {
  color: var(--rw-black);
  background: var(--rw-yellow-light);
  border-color: var(--rw-yellow);
}

.copy-btn svg,
.copy-btn i {
  width: 13px;
  height: 13px;
}

.streaming-cursor {
  display: inline-block;
  width: 2px;
  height: 1.1em;
  background: var(--rw-yellow);
  vertical-align: text-bottom;
  animation: streamingBlink 0.8s step-end infinite;
  margin-left: 2px;
}

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


/* ================================================================
   TOOL CARD CATEGORY (Dynamic)
   ================================================================ */
.tool-card-category {
  display: inline-block;
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--rw-yellow-hover);
  position: relative;
  z-index: 1;
  margin-top: auto;
}

.tool-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-xl);
  border-left-color: var(--rw-yellow);
  border-color: var(--rw-yellow);
}

.tool-card:active {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}


/* ================================================================
   DASHBOARD RECENT CONVERSATIONS (Dynamic)
   ================================================================ */
.recent-conversation-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  background: var(--color-bg-card);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-base);
}

.recent-conversation-item:hover {
  border-color: var(--rw-yellow);
  box-shadow: var(--shadow-sm);
  transform: translateX(4px);
}

.recent-conversation-item:active {
  transform: translateX(2px);
}

.recent-conv-icon {
  width: 36px;
  height: 36px;
  min-width: 36px;
  background: var(--rw-yellow-subtle);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--rw-yellow-hover);
  transition: background-color var(--transition-base);
}

.recent-conversation-item:hover .recent-conv-icon {
  background: rgba(255, 229, 18, 0.15);
}

.recent-conv-icon svg,
.recent-conv-icon i {
  width: 18px;
  height: 18px;
}

.recent-conv-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.recent-conv-title {
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--color-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.recent-conv-meta {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.recent-conv-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
  transition: all var(--transition-base);
  flex-shrink: 0;
}

.recent-conversation-item:hover .recent-conv-arrow {
  color: var(--rw-yellow-hover);
  transform: translateX(3px);
}

.recent-conv-arrow svg,
.recent-conv-arrow i {
  width: 16px;
  height: 16px;
}


/* ================================================================
   HISTORY ITEMS (Dynamic)
   ================================================================ */
.history-group {
  margin-bottom: var(--space-lg);
}

.history-group-label {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--color-text-muted);
  padding: var(--space-sm) 0;
  margin-bottom: var(--space-sm);
  border-bottom: 1px solid var(--color-border-light);
}

.history-item-meta {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.history-item-actions {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  flex-shrink: 0;
  opacity: 0;
  transition: opacity var(--transition-base);
}

.history-item:hover .history-item-actions {
  opacity: 1;
}


/* ================================================================
   ADMIN USERS TABLE (Dynamic)
   ================================================================ */
.user-cell {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.user-cell-avatar {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--rw-yellow), #e6cf10);
  color: var(--rw-black);
  font-size: var(--text-xs);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.user-cell-name {
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--color-text-primary);
  line-height: 1.3;
}

.user-cell-username {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  line-height: 1.3;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-admin {
  background: var(--rw-yellow);
  color: var(--rw-black);
}

.badge-agent {
  background: #e8e8e8;
  color: var(--rw-dark-grey);
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: var(--radius-sm);
  color: var(--color-text-muted);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all var(--transition-base);
}

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

.btn-icon svg,
.btn-icon i {
  width: 16px;
  height: 16px;
}

.btn-danger-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: var(--radius-sm);
  color: var(--color-text-muted);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all var(--transition-base);
}

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

.btn-danger-icon svg,
.btn-danger-icon i {
  width: 16px;
  height: 16px;
}


/* ================================================================
   SIDEBAR TOOL ITEMS (Dynamic)
   ================================================================ */
.sidebar-tool-btn {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  width: 100%;
  padding: 8px 14px 8px 24px;
  border-radius: var(--radius-md);
  color: rgba(255, 255, 255, 0.45);
  font-size: var(--text-xs);
  font-weight: 500;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all var(--transition-base);
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
}

.sidebar-tool-btn:hover {
  color: rgba(255, 255, 255, 0.85);
  background: rgba(255, 255, 255, 0.05);
}

.sidebar-tool-btn:hover .sidebar-tool-icon {
  color: var(--rw-yellow);
}

.sidebar-tool-icon {
  width: 16px;
  height: 16px;
  min-width: 16px;
  color: inherit;
  transition: color var(--transition-base);
}

.sidebar-tool-btn svg,
.sidebar-tool-btn i {
  width: 16px;
  height: 16px;
  min-width: 16px;
  flex-shrink: 0;
}

.sidebar-tool-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.collapsed .sidebar-tool-name {
  opacity: 0;
  pointer-events: none;
}

.sidebar-tool-empty {
  padding: 8px 14px 8px 24px;
  font-size: var(--text-xs);
  color: rgba(255, 255, 255, 0.25);
  font-style: italic;
}


/* ================================================================
   MODAL DYNAMIC
   ================================================================ */
.modal-dialog {
  width: 100%;
  max-width: 520px;
  background: var(--color-bg-card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-2xl);
  overflow: hidden;
  animation: modalEnter 0.3s ease-out;
}

#project-modal .modal-dialog {
  max-width: 680px;
}

.modal-title {
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--color-text-primary);
}

.modal-close-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  color: var(--color-text-muted);
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: var(--text-xl);
  line-height: 1;
  transition: all var(--transition-base);
}

.modal-close-btn:hover {
  background: var(--color-border-light);
  color: var(--color-text-primary);
}

.modal-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-md);
  padding-top: var(--space-lg);
  margin-top: var(--space-lg);
  border-top: 1px solid var(--color-border-light);
}


/* ================================================================
   FORM CLASSES (Dynamic Modals)
   ================================================================ */
.form-stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.form-control {
  width: 100%;
  padding: 12px 16px;
  background: var(--color-bg-input-light);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  color: var(--color-text-primary);
  transition: all var(--transition-base);
}

.form-control:focus {
  outline: none;
  border-color: var(--rw-yellow);
  box-shadow: 0 0 0 3px var(--rw-yellow-glow);
  background: var(--rw-white);
}

.form-control::placeholder {
  color: var(--color-text-muted);
}

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23595959' 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 12px center;
  padding-right: 40px;
}


/* ================================================================
   UTILITY CLASSES (Dynamic)
   ================================================================ */
.text-muted {
  color: var(--color-text-muted);
}

.btn-loading {
  position: relative;
  pointer-events: none;
  opacity: 0.75;
}

.btn-loading .spinner {
  width: 16px;
  height: 16px;
}


/* ================================================================
   SUGGESTED PROMPT CARDS
   ================================================================ */
.suggested-prompts-section {
  margin-top: var(--space-xl);
  width: 100%;
  max-width: 700px;
}

.suggested-prompts-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-md);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.suggested-prompts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--space-sm);
}

.suggested-prompt-card {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-md);
  background: var(--color-bg-card);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-base);
  text-align: left;
  font-family: var(--font-body);
}

.suggested-prompt-card:hover {
  border-color: var(--rw-yellow);
  background: var(--rw-yellow-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md), 0 0 0 1px var(--rw-yellow);
}

.suggested-prompt-card:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

.suggested-prompt-icon {
  width: 32px;
  height: 32px;
  min-width: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--rw-yellow-subtle);
  border-radius: var(--radius-sm);
  color: var(--rw-yellow-hover);
  transition: all var(--transition-base);
}

.suggested-prompt-card:hover .suggested-prompt-icon {
  background: var(--rw-yellow);
  color: var(--rw-black);
}

.suggested-prompt-icon svg,
.suggested-prompt-icon i {
  width: 16px;
  height: 16px;
}

.suggested-prompt-label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-primary);
  line-height: 1.3;
}


/* ================================================================
   STREAM ERROR / RETRY
   ================================================================ */
.stream-error {
  margin-top: var(--space-md);
  padding: var(--space-md);
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: var(--radius-lg);
  text-align: center;
}

.stream-error p {
  margin: 0 0 var(--space-sm) 0;
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
}

.stream-error .retry-btn {
  gap: 6px;
}


/* ================================================================
   OUTPUT ACTION BAR
   ================================================================ */
.message-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-muted);
  background: transparent;
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-base);
  white-space: nowrap;
  font-family: var(--font-body);
}

.action-btn:hover {
  color: var(--rw-black);
  background: var(--rw-yellow-light);
  border-color: var(--rw-yellow);
}

.action-btn:active {
  background: var(--rw-yellow);
}

.action-btn svg,
.action-btn i {
  width: 13px;
  height: 13px;
}

.action-btn.regenerate-btn:hover {
  color: var(--color-info);
  border-color: var(--color-info);
  background: var(--color-info-bg);
}


/* ================================================================
   CATEGORY FILTER PILLS
   ================================================================ */
.category-filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
}

.filter-pill {
  padding: 6px 16px;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-secondary);
  background: var(--color-bg-card);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition-base);
  font-family: var(--font-body);
  white-space: nowrap;
}

.filter-pill:hover {
  border-color: var(--rw-yellow);
  color: var(--color-text-primary);
  background: var(--rw-yellow-light);
}

.filter-pill.active {
  background: var(--rw-yellow);
  color: var(--rw-black);
  border-color: var(--rw-yellow);
  box-shadow: var(--shadow-yellow);
}

.filter-pill.active:hover {
  background: var(--rw-yellow-hover);
}


/* ================================================================
   ENHANCED CHAT EMPTY STATE
   ================================================================ */
.chat-empty-state h3 {
  font-family: var(--font-heading);
  font-size: var(--text-2xl);
  color: var(--color-text-primary);
  margin-bottom: var(--space-sm);
}

.chat-empty-state p {
  max-width: 500px;
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--color-text-secondary);
}

.chat-empty-icon {
  width: 80px;
  height: 80px;
  background: linear-gradient(135deg, var(--rw-yellow) 0%, var(--rw-yellow-hover) 100%);
  border-radius: var(--radius-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-lg);
  box-shadow: var(--shadow-yellow-lg);
}

.chat-empty-icon svg,
.chat-empty-icon i {
  width: 36px;
  height: 36px;
  color: var(--rw-black);
}


/* ================================================================
   RESPONSIVE: SUGGESTED PROMPTS & FILTERS
   ================================================================ */
@media (max-width: 768px) {
  .suggested-prompts-grid {
    grid-template-columns: 1fr 1fr;
  }

  .category-filter-pills {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: var(--space-xs);
    -webkit-overflow-scrolling: touch;
  }

  .message-actions {
    gap: 4px;
  }

  .action-btn {
    padding: 2px 8px;
    font-size: 11px;
  }
}

@media (max-width: 480px) {
  .suggested-prompts-grid {
    grid-template-columns: 1fr;
  }

  .suggested-prompt-card {
    padding: var(--space-sm) var(--space-md);
  }
}


/* ================================================================
   PRINT STYLES
   ================================================================ */
/* ================================================================
   DASHBOARD SEARCH BAR
   ================================================================ */
.tools-search {
  position: relative;
  display: flex;
  align-items: center;
}

.tools-search-icon {
  position: absolute;
  left: 16px;
  width: 20px;
  height: 20px;
  color: var(--color-text-muted);
  pointer-events: none;
  z-index: 1;
}

.tools-search-input {
  width: 100%;
  padding: 14px 48px 14px 48px;
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: 400;
  color: var(--color-text-primary);
  background: var(--color-bg-card);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-lg);
  outline: none;
  transition: border-color var(--transition-base), box-shadow var(--transition-base);
}

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

.tools-search-input:focus {
  border-color: var(--rw-yellow);
  box-shadow: 0 0 0 3px var(--rw-yellow-glow);
}

.tools-search-clear {
  position: absolute;
  right: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all var(--transition-base);
}

.tools-search-clear:hover {
  background: var(--color-border-light);
  color: var(--color-text-primary);
}

.tools-search-clear svg,
.tools-search-clear i {
  width: 18px;
  height: 18px;
}


/* ================================================================
   RECENTLY USED TOOLS
   ================================================================ */
.recently-used {
  display: flex;
  gap: var(--space-md);
  overflow-x: auto;
  padding-bottom: var(--space-xs);
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.recently-used::-webkit-scrollbar {
  display: none;
}

.recently-used-card {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg);
  background: var(--color-bg-card);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-base);
  white-space: nowrap;
  flex-shrink: 0;
  min-width: 0;
}

.recently-used-card:hover {
  border-color: var(--rw-yellow);
  box-shadow: 0 4px 16px rgba(255, 229, 18, 0.15);
  transform: translateY(-2px);
}

.recently-used-card:active {
  transform: translateY(-1px);
}

.recently-used-card-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: var(--radius-md);
  background: var(--rw-yellow-subtle);
  color: var(--rw-yellow-hover);
  transition: background-color var(--transition-base);
}

.recently-used-card:hover .recently-used-card-icon {
  background: rgba(255, 229, 18, 0.18);
}

.recently-used-card-icon svg,
.recently-used-card-icon i {
  width: 18px;
  height: 18px;
}

.recently-used-card-name {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-primary);
}

.recently-used-empty {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg);
  background: var(--rw-yellow-subtle);
  border: 1px solid rgba(255, 229, 18, 0.15);
  border-radius: var(--radius-lg);
  width: 100%;
}

.recently-used-empty svg,
.recently-used-empty i {
  width: 20px;
  height: 20px;
  color: var(--rw-yellow-hover);
  flex-shrink: 0;
}

.recently-used-empty p {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin: 0;
}


/* ================================================================
   SHOW ALL TOOLS TOGGLE
   ================================================================ */
.show-all-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  width: 100%;
  padding: 12px var(--space-lg);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-secondary);
  background: var(--color-bg-card);
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-base);
}

.show-all-toggle:hover {
  border-color: var(--rw-yellow);
  color: var(--color-text-primary);
  background: var(--rw-yellow-subtle);
}

.show-all-toggle svg,
.show-all-toggle i {
  width: 16px;
  height: 16px;
}

.show-all-chevron {
  transition: transform var(--transition-base);
}


/* ================================================================
   RESPONSIVE: SEARCH + RECENTLY USED
   ================================================================ */
@media (max-width: 767px) {
  .tools-search-input {
    padding: 12px 44px 12px 44px;
    font-size: var(--text-sm);
  }

  .tools-search-icon {
    left: 14px;
    width: 18px;
    height: 18px;
  }

  .recently-used {
    gap: var(--space-sm);
  }

  .recently-used-card {
    padding: var(--space-sm) var(--space-md);
  }

  .recently-used-card-icon {
    width: 30px;
    height: 30px;
    min-width: 30px;
  }

  .recently-used-card-icon svg,
  .recently-used-card-icon i {
    width: 15px;
    height: 15px;
  }

  .recently-used-card-name {
    font-size: var(--text-xs);
  }

  .show-all-toggle {
    padding: 10px var(--space-md);
    font-size: var(--text-xs);
  }
}


@media print {
  .sidebar,
  .sidebar-overlay,
  .mobile-menu-btn,
  .chat-input-area,
  .toast-container,
  .modal-overlay {
    display: none !important;
  }

  .main-content {
    margin-left: 0 !important;
  }

  .app {
    display: block;
  }

  body {
    background: white;
    color: black;
  }
}


/* ================================================================
   PROJECTS STYLES
   ================================================================ */

/* View header row with button */
.view-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
}

/* Projects Grid */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
  margin-top: 8px;
}

.project-card {
  background: var(--card-bg, #ffffff);
  border: 1px solid var(--border-color, #e5e5e5);
  border-radius: 12px;
  padding: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.project-card:hover {
  border-color: var(--primary, #FFE512);
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
  transform: translateY(-2px);
}

.project-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.project-card-status {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 10px;
  border-radius: 20px;
}

.project-card-status.status-active {
  background: #e6f9e6;
  color: #1a7a1a;
}

.project-card-status.status-sold {
  background: #fff3e0;
  color: #b36b00;
}

.project-card-status.status-other {
  background: #f0f0f0;
  color: #666;
}

.project-card-type {
  font-size: 12px;
  color: #888;
  font-weight: 500;
}

.project-card-name {
  font-family: 'Playfair Display', serif;
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 4px 0;
  color: var(--text-primary, #1a1a1a);
}

.project-card-address {
  font-size: 13px;
  color: #888;
  margin: 0 0 12px 0;
}

.project-card-details {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.project-detail-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: #555;
  background: #f5f5f5;
  padding: 3px 10px;
  border-radius: 6px;
}

.project-detail-tag svg {
  width: 14px;
  height: 14px;
}

.project-card-price {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary, #1a1a1a);
  margin-bottom: 10px;
}

.project-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: #999;
  border-top: 1px solid #f0f0f0;
  padding-top: 10px;
}

.project-card-listing {
  font-weight: 600;
  color: #666;
}

/* Project Detail Panel */
.project-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.project-detail-actions {
  display: flex;
  gap: 8px;
}

.project-back-btn {
  gap: 6px;
}

.project-detail-summary {
  background: var(--card-bg, #ffffff);
  border: 1px solid var(--border-color, #e5e5e5);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 24px;
}

.project-detail-name {
  font-family: 'Playfair Display', serif;
  font-size: 24px;
  font-weight: 600;
  margin: 0 0 4px 0;
}

.project-detail-address {
  font-size: 14px;
  color: #888;
  margin: 0 0 20px 0;
}

.project-property-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 20px;
}

.property-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 80px;
}

.property-stat-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #999;
  font-weight: 600;
}

.property-stat-value {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary, #1a1a1a);
}

.project-detail-desc {
  margin-bottom: 16px;
}

.project-detail-desc h4 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #999;
  font-weight: 600;
  margin: 0 0 4px 0;
}

.project-detail-desc p {
  font-size: 14px;
  color: #555;
  margin: 0;
  line-height: 1.5;
}

.project-features-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.feature-tag {
  display: inline-block;
  font-size: 12px;
  background: #f5f5f5;
  color: #555;
  padding: 4px 10px;
  border-radius: 6px;
  font-weight: 500;
}

/* Project Detail Sections */
.project-detail-section {
  background: var(--card-bg, #ffffff);
  border: 1px solid var(--border-color, #e5e5e5);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 24px;
}

.project-detail-section h3 {
  font-family: 'Playfair Display', serif;
  font-size: 18px;
  margin: 0 0 8px 0;
}

/* Tool Search in Project Detail */
.project-tools-search {
  margin-top: 12px;
}
.project-tools-search .form-input {
  width: 100%;
  max-width: 360px;
}

/* Tool Launcher in Project Detail */
.project-tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
  margin-top: 12px;
  max-height: 400px;
  overflow-y: auto;
  padding-right: 4px;
}

.project-tool-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: #f8f8f8;
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: #333;
  transition: all 0.15s ease;
}

.project-tool-btn:hover {
  background: #080000;
  color: #FFE512;
  border-color: #080000;
}

.project-tool-btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.project-tool-btn span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Conversations in Project Detail */
.project-conversations-list {
  margin-top: 12px;
}

.project-convo-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.project-convo-item:hover {
  background: #f5f5f5;
}

.project-convo-item svg {
  width: 16px;
  height: 16px;
  color: #888;
  flex-shrink: 0;
}

.project-convo-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.project-convo-title {
  font-size: 14px;
  font-weight: 500;
  color: #333;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-convo-date {
  font-size: 12px;
  color: #999;
}

/* Chat Project Badge */
.chat-header-project-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #080000;
  color: #FFE512;
  padding: 4px 12px 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  max-width: 250px;
}

.chat-header-project-badge svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.chat-header-project-badge span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-badge-clear {
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: #FFE512;
  cursor: pointer;
  padding: 2px;
  margin-left: 2px;
  border-radius: 50%;
  opacity: 0.7;
  transition: opacity 0.15s;
}

.btn-badge-clear:hover {
  opacity: 1;
}

.btn-badge-clear svg {
  width: 12px;
  height: 12px;
}

/* Project Form (in Modal) */
.project-form {
  max-height: 65vh;
  overflow-y: auto;
  padding-right: 4px;
}

.project-form-section {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid #f0f0f0;
}

.project-form-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.project-form-section h4 {
  font-family: 'Playfair Display', serif;
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 12px 0;
  color: var(--text-primary, #1a1a1a);
}

.form-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.form-row .form-group {
  flex: 1;
  min-width: 120px;
}

.form-group-wide {
  flex: 2 !important;
}

/* Danger button */
.btn-danger {
  background: #dc3545;
  color: #fff;
  border: none;
}

.btn-danger:hover {
  background: #c82333;
}

/* Responsive Projects */
@media (max-width: 768px) {
  .projects-grid {
    grid-template-columns: 1fr;
  }

  .project-tools-grid {
    grid-template-columns: 1fr 1fr;
  }

  .project-detail-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .project-property-stats {
    gap: 12px;
  }

  .form-row {
    flex-direction: column;
    gap: 8px;
  }

  .chat-header-project-badge {
    max-width: 160px;
  }
}


/* ================================================================
   DARK MODE THEME
   ================================================================ */

/* Dark theme CSS variable overrides */
[data-theme="dark"] {
  --color-bg-primary: #0f1117;
  --color-bg-secondary: #1a1d27;
  --color-bg-card: #1e2130;
  --color-bg-input: #252838;
  --color-bg-input-light: #252838;
  --color-bg-hover: #2a2d3e;
  --color-text-primary: #e4e6ef;
  --color-text-secondary: #9da3b4;
  --color-text-tertiary: #6b7280;
  --color-text-muted: #6b7280;
  --color-text-on-dark: #e4e6ef;
  --color-border: #2d3148;
  --color-border-light: #363a50;
  --color-border-dark: #1a1d27;

  --color-bg-dark: #0a0c14;
  --color-bg-darker: #060810;

  --rw-offwhite: #0f1117;
  --rw-white: #e4e6ef;

  --color-success-bg: rgba(34, 197, 94, 0.1);
  --color-error-bg: rgba(239, 68, 68, 0.1);
  --color-info-bg: rgba(59, 130, 246, 0.1);
  --color-warning-bg: rgba(245, 158, 11, 0.1);

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.35), 0 2px 4px -2px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -4px rgba(0, 0, 0, 0.25);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.45), 0 8px 10px -6px rgba(0, 0, 0, 0.25);
  --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
}

/* Dark mode body */
[data-theme="dark"] body {
  background-color: var(--color-bg-primary);
  color: var(--color-text-primary);
}

/* Dark mode scrollbar for light areas */
[data-theme="dark"] .main-content::-webkit-scrollbar-track,
[data-theme="dark"] .chat-messages::-webkit-scrollbar-track {
  background: #1a1d27;
}

[data-theme="dark"] .main-content::-webkit-scrollbar-thumb,
[data-theme="dark"] .chat-messages::-webkit-scrollbar-thumb {
  background: #3a3e52;
  border: 1px solid #1a1d27;
}

[data-theme="dark"] .main-content::-webkit-scrollbar-thumb:hover,
[data-theme="dark"] .chat-messages::-webkit-scrollbar-thumb:hover {
  background: #4a4e62;
}

[data-theme="dark"] .main-content,
[data-theme="dark"] .chat-messages {
  scrollbar-color: #3a3e52 #1a1d27;
}

/* Dark mode sidebar - sidebar is already dark, keep it consistent */
[data-theme="dark"] .sidebar {
  background: linear-gradient(180deg, #0a0c14 0%, #0d0f1a 50%, #101320 100%);
  border-right-color: rgba(255, 255, 255, 0.04);
}

/* Dark mode chat bubbles */
[data-theme="dark"] .chat-message--user .message-bubble,
[data-theme="dark"] .message-bubble.user {
  background: linear-gradient(135deg, #332d00 0%, #3d3600 100%);
  border-color: rgba(255, 229, 18, 0.15);
  color: var(--color-text-primary);
}

[data-theme="dark"] .chat-message--ai .message-bubble,
[data-theme="dark"] .message-bubble.assistant {
  background: var(--color-bg-card);
  border-color: var(--color-border-light);
  color: var(--color-text-primary);
}

/* Dark mode inline code */
[data-theme="dark"] .message-bubble code,
[data-theme="dark"] .message-content code {
  background: rgba(255, 255, 255, 0.08);
  color: #e4e6ef;
}

/* Dark mode blockquote */
[data-theme="dark"] .message-content blockquote {
  background: rgba(255, 255, 255, 0.03);
  color: var(--color-text-secondary);
}

/* Dark mode tables in messages */
[data-theme="dark"] .message-content th {
  background: var(--color-bg-secondary);
}

[data-theme="dark"] .message-content tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.02);
}

/* Dark mode links in messages */
[data-theme="dark"] .message-content a {
  color: #60a5fa;
}

[data-theme="dark"] .message-content a:hover {
  color: #93bbfd;
}

/* Dark mode chat input */
[data-theme="dark"] .chat-input-area {
  background: var(--color-bg-primary);
  border-top-color: var(--color-border);
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.15);
}

[data-theme="dark"] .chat-input-container {
  background: var(--color-bg-card);
  border-color: var(--color-border);
}

[data-theme="dark"] .chat-textarea {
  color: var(--color-text-primary);
}

[data-theme="dark"] .chat-textarea::placeholder {
  color: var(--color-text-muted);
}

/* Dark mode chat header */
[data-theme="dark"] .chat-header {
  background: var(--color-bg-card);
  border-bottom-color: var(--color-border-light);
}

/* Dark mode dashboard hero - keep as-is since it's image-based */

/* Dark mode privacy banner */
[data-theme="dark"] .privacy-banner {
  background: linear-gradient(90deg, rgba(34, 197, 94, 0.08) 0%, rgba(34, 197, 94, 0.05) 100%);
  border-bottom-color: rgba(34, 197, 94, 0.15);
}

[data-theme="dark"] .privacy-banner-content strong {
  color: #4ade80;
}

[data-theme="dark"] .privacy-banner-content span {
  color: #86efac;
}

/* Dark mode stat cards */
[data-theme="dark"] .stat-card {
  background: var(--color-bg-card);
  border-color: var(--color-border-light);
}

/* Dark mode calculator cards */
[data-theme="dark"] .calculator-card {
  background: var(--color-bg-card);
  border-color: var(--color-border-light);
}

[data-theme="dark"] .calculator-card-icon--blue {
  background: rgba(59, 130, 246, 0.12);
}

[data-theme="dark"] .calculator-card-icon--green {
  background: rgba(34, 197, 94, 0.12);
}

[data-theme="dark"] .calculator-card-icon--amber {
  background: rgba(245, 158, 11, 0.12);
}

/* Dark mode tool cards */
[data-theme="dark"] .tool-card {
  background: var(--color-bg-card);
  border-color: var(--color-border-light);
}

[data-theme="dark"] .tool-card::after {
  background: linear-gradient(135deg, rgba(255, 229, 18, 0.04) 0%, transparent 60%);
}

/* Dark mode pro tips */
[data-theme="dark"] .pro-tip-card {
  background: rgba(255, 229, 18, 0.04);
  border-color: rgba(255, 229, 18, 0.1);
}

/* Dark mode conversation items */
[data-theme="dark"] .conversation-item,
[data-theme="dark"] .recent-conversation-item {
  background: var(--color-bg-card);
  border-color: var(--color-border-light);
}

/* Dark mode newcastle banner */
[data-theme="dark"] .newcastle-banner {
  background: var(--color-bg-card);
  border-color: var(--color-border-light);
}

/* Dark mode view header */
[data-theme="dark"] .view-header {
  background: var(--color-bg-card);
  border-bottom-color: var(--color-border-light);
}

/* Dark mode search input */
[data-theme="dark"] .search-input {
  background: var(--color-bg-card);
  border-color: var(--color-border);
  color: var(--color-text-primary);
}

/* Dark mode history items */
[data-theme="dark"] .history-item:hover {
  background: var(--color-bg-hover);
}

/* Dark mode admin cards */
[data-theme="dark"] .admin-card {
  background: var(--color-bg-card);
  border-color: var(--color-border-light);
}

[data-theme="dark"] .admin-card-header {
  background: var(--color-bg-secondary);
  border-bottom-color: var(--color-border-light);
}

/* Dark mode forms */
[data-theme="dark"] .form-input,
[data-theme="dark"] .form-select,
[data-theme="dark"] .form-control {
  background: var(--color-bg-input);
  border-color: var(--color-border);
  color: var(--color-text-primary);
}

[data-theme="dark"] .form-input:focus,
[data-theme="dark"] .form-select:focus,
[data-theme="dark"] .form-control:focus {
  background: var(--color-bg-input);
  border-color: var(--rw-yellow);
}

/* Dark mode users table */
[data-theme="dark"] .users-table th {
  border-bottom-color: var(--color-border);
  color: var(--color-text-muted);
}

[data-theme="dark"] .users-table td {
  border-bottom-color: var(--color-border-light);
  color: var(--color-text-primary);
}

[data-theme="dark"] .users-table tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.02);
}

[data-theme="dark"] .users-table tbody tr:hover {
  background: rgba(255, 229, 18, 0.04);
}

/* Dark mode role badge (agent) */
[data-theme="dark"] .role-badge--agent,
[data-theme="dark"] .badge-agent {
  background: #2d3148;
  color: var(--color-text-secondary);
}

/* Dark mode info grid */
[data-theme="dark"] .info-item {
  background: var(--color-bg-secondary);
  border-color: var(--color-border-light);
}

/* Dark mode modals */
[data-theme="dark"] .modal-overlay {
  background: rgba(0, 0, 0, 0.7);
}

[data-theme="dark"] .modal-card,
[data-theme="dark"] .modal-dialog {
  background: var(--color-bg-card);
}

[data-theme="dark"] .modal-header {
  border-bottom-color: var(--color-border-light);
}

[data-theme="dark"] .modal-footer {
  border-top-color: var(--color-border-light);
  background: var(--color-bg-secondary);
}

[data-theme="dark"] .modal-warning {
  background: rgba(245, 158, 11, 0.08);
  border-color: rgba(245, 158, 11, 0.15);
}

[data-theme="dark"] .modal-warning p {
  color: #fbbf24;
}

/* Dark mode toasts */
[data-theme="dark"] .toast {
  background: var(--color-bg-card);
  border-color: var(--color-border-light);
}

/* Dark mode typing indicator */
[data-theme="dark"] .typing-dots {
  background: var(--color-bg-card);
  border-color: var(--color-border-light);
}

/* Dark mode filter pills & tabs */
[data-theme="dark"] .tool-filter-tab {
  background: var(--color-bg-card);
  border-color: var(--color-border);
  color: var(--color-text-secondary);
}

[data-theme="dark"] .filter-pill {
  background: var(--color-bg-card);
  border-color: var(--color-border-light);
  color: var(--color-text-secondary);
}

[data-theme="dark"] .filter-pill:hover {
  background: rgba(255, 229, 18, 0.08);
  border-color: var(--rw-yellow);
}

/* Dark mode suggested prompt cards */
[data-theme="dark"] .suggested-prompt-card {
  background: var(--color-bg-card);
  border-color: var(--color-border-light);
}

[data-theme="dark"] .suggested-prompt-card:hover {
  background: rgba(255, 229, 18, 0.08);
  border-color: var(--rw-yellow);
}

/* Dark mode recently used cards */
[data-theme="dark"] .recently-used-card {
  background: var(--color-bg-card);
  border-color: var(--color-border-light);
}

/* Dark mode show all toggle */
[data-theme="dark"] .show-all-toggle {
  background: var(--color-bg-card);
  border-color: var(--color-border);
  color: var(--color-text-secondary);
}

[data-theme="dark"] .show-all-toggle:hover {
  background: rgba(255, 229, 18, 0.04);
  border-color: var(--rw-yellow);
}

/* Dark mode tools search */
[data-theme="dark"] .tools-search-input {
  background: var(--color-bg-card);
  border-color: var(--color-border);
  color: var(--color-text-primary);
}

/* Dark mode module cards */
[data-theme="dark"] .module-card {
  background: var(--color-bg-secondary);
  border-color: var(--color-border-light);
}

[data-theme="dark"] .user-module-toggle {
  background: var(--color-bg-secondary);
  border-color: var(--color-border-light);
}

[data-theme="dark"] .user-module-toggle.active {
  border-color: var(--rw-yellow);
  background: rgba(255, 229, 18, 0.06);
}

/* Dark mode project cards */
[data-theme="dark"] .project-card {
  background: var(--color-bg-card);
  border-color: var(--color-border-light);
}

[data-theme="dark"] .project-card:hover {
  border-color: var(--rw-yellow);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .project-card-name,
[data-theme="dark"] .project-detail-name {
  color: var(--color-text-primary);
}

[data-theme="dark"] .project-card-address,
[data-theme="dark"] .project-detail-address {
  color: var(--color-text-muted);
}

[data-theme="dark"] .project-card-price,
[data-theme="dark"] .property-stat-value {
  color: var(--color-text-primary);
}

[data-theme="dark"] .project-card-type,
[data-theme="dark"] .project-card-footer,
[data-theme="dark"] .property-stat-label,
[data-theme="dark"] .project-detail-desc h4 {
  color: var(--color-text-muted);
}

[data-theme="dark"] .project-card-footer {
  border-top-color: var(--color-border-light);
}

[data-theme="dark"] .project-card-listing {
  color: var(--color-text-secondary);
}

[data-theme="dark"] .project-card-status.status-active {
  background: rgba(34, 197, 94, 0.12);
  color: #4ade80;
}

[data-theme="dark"] .project-card-status.status-sold {
  background: rgba(245, 158, 11, 0.12);
  color: #fbbf24;
}

[data-theme="dark"] .project-card-status.status-other {
  background: rgba(107, 114, 128, 0.15);
  color: #9da3b4;
}

[data-theme="dark"] .project-detail-tag,
[data-theme="dark"] .feature-tag {
  background: var(--color-bg-hover);
  color: var(--color-text-secondary);
}

[data-theme="dark"] .project-detail-summary,
[data-theme="dark"] .project-detail-section {
  background: var(--color-bg-card);
  border-color: var(--color-border-light);
}

[data-theme="dark"] .project-detail-desc p,
[data-theme="dark"] .project-convo-title {
  color: var(--color-text-secondary);
}

[data-theme="dark"] .project-tool-btn {
  background: var(--color-bg-secondary);
  border-color: var(--color-border-light);
  color: var(--color-text-secondary);
}

[data-theme="dark"] .project-tool-btn:hover {
  background: #080000;
  color: #FFE512;
  border-color: #080000;
}

[data-theme="dark"] .project-convo-item:hover {
  background: var(--color-bg-hover);
}

[data-theme="dark"] .project-convo-date {
  color: var(--color-text-muted);
}

[data-theme="dark"] .project-form-section {
  border-bottom-color: var(--color-border-light);
}

/* Dark mode action buttons */
[data-theme="dark"] .action-btn {
  color: var(--color-text-muted);
  border-color: var(--color-border-light);
}

[data-theme="dark"] .action-btn:hover {
  color: var(--rw-black);
  background: var(--rw-yellow);
  border-color: var(--rw-yellow);
}

/* Dark mode copy button */
[data-theme="dark"] .copy-btn {
  color: var(--color-text-muted);
  border-color: var(--color-border-light);
}

[data-theme="dark"] .copy-btn:hover {
  color: var(--rw-black);
  background: var(--rw-yellow);
  border-color: var(--rw-yellow);
}

/* Dark mode doc chip */
[data-theme="dark"] .doc-chip {
  background: var(--color-bg-secondary);
  border-color: var(--color-border);
}

/* Dark mode drop overlay */
[data-theme="dark"] .drop-overlay {
  background: rgba(255, 229, 18, 0.05);
}

/* Dark mode chat input hint */
[data-theme="dark"] .chat-input-hint kbd {
  background: var(--color-bg-secondary);
  border-color: var(--color-border);
  box-shadow: 0 1px 0 var(--color-border);
}

/* Dark mode btn-secondary */
[data-theme="dark"] .btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--color-border);
  color: var(--color-text-secondary);
}

[data-theme="dark"] .btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--rw-yellow);
  color: var(--color-text-primary);
}

/* Dark mode btn-ghost */
[data-theme="dark"] .btn-ghost:hover {
  background: rgba(255, 229, 18, 0.06);
}

/* Dark mode btn-icon */
[data-theme="dark"] .btn-icon:hover {
  background: var(--color-bg-hover);
  color: var(--color-text-primary);
}

/* Dark mode stream error */
[data-theme="dark"] .stream-error {
  background: rgba(239, 68, 68, 0.06);
  border-color: rgba(239, 68, 68, 0.15);
}

/* Dark mode shimmer */
[data-theme="dark"] .shimmer {
  background: linear-gradient(
    90deg,
    var(--color-border-light) 25%,
    var(--color-bg-hover) 37%,
    var(--color-border-light) 63%
  );
  background-size: 200% 100%;
}

/* Dark mode selection */
[data-theme="dark"] ::selection {
  background-color: var(--rw-yellow);
  color: var(--rw-black);
}

/* Dark mode app footer */
[data-theme="dark"] .app-footer {
  border-top-color: var(--color-border-light);
}

/* Dark mode empty state */
[data-theme="dark"] .empty-state h3 {
  color: var(--color-text-secondary);
}

/* Dark mode section link */
[data-theme="dark"] .section-link {
  color: var(--color-text-secondary);
}

[data-theme="dark"] .section-link:hover {
  color: var(--color-text-primary);
}

/* Dark mode test result */
[data-theme="dark"] .test-result.success {
  background: rgba(34, 197, 94, 0.08);
  color: #4ade80;
  border-color: rgba(34, 197, 94, 0.15);
}

[data-theme="dark"] .test-result.error {
  background: rgba(239, 68, 68, 0.08);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.15);
}

/* Dark mode module badge inactive */
[data-theme="dark"] .module-badge-inactive {
  background: rgba(239, 68, 68, 0.1);
  color: #f87171;
}

/* Dark mode history date label */
[data-theme="dark"] .history-date-label,
[data-theme="dark"] .history-group-label {
  border-bottom-color: var(--color-border-light);
}

/* Dark mode modal actions */
[data-theme="dark"] .modal-actions {
  border-top-color: var(--color-border-light);
}

/* Dark mode login error within login form (login page itself is already dark) */

/* Dark mode print - revert to light for print */
@media print {
  [data-theme="dark"] body {
    background: white;
    color: black;
  }
}

/* ── Dark Mode Toggle Button ── */
.dark-mode-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--color-text-muted);
  border: 1px solid var(--color-border-light);
  cursor: pointer;
  transition: all var(--transition-base);
  padding: 0;
  flex-shrink: 0;
}

.dark-mode-toggle:hover {
  color: var(--rw-yellow);
  border-color: var(--rw-yellow);
  background: rgba(255, 229, 18, 0.06);
}

.dark-mode-toggle svg,
.dark-mode-toggle i {
  width: 18px;
  height: 18px;
}

[data-theme="dark"] .dark-mode-toggle {
  color: var(--rw-yellow);
  border-color: rgba(255, 229, 18, 0.2);
  background: rgba(255, 229, 18, 0.06);
}

[data-theme="dark"] .dark-mode-toggle:hover {
  background: rgba(255, 229, 18, 0.12);
  border-color: var(--rw-yellow);
}


/* ================================================================
   CONTACTS VIEW
   ================================================================ */

/* Contacts Grid */
.contacts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--space-lg);
  padding: 0 var(--space-2xl) var(--space-2xl);
}

/* Contact Card */
.contact-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  transition: all var(--transition-base);
  cursor: pointer;
  position: relative;
}

.contact-card:hover {
  border-color: var(--rw-yellow);
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.contact-card-header {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.contact-avatar {
  width: 48px;
  height: 48px;
  min-width: 48px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--rw-yellow), #e6cf10);
  color: var(--rw-black);
  font-weight: 700;
  font-size: var(--text-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  text-transform: uppercase;
}

.contact-name {
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--color-text-primary);
  line-height: 1.3;
}

.contact-company {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-top: 2px;
}

.contact-details {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.contact-detail-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}

.contact-detail-row svg,
.contact-detail-row i {
  width: 15px;
  height: 15px;
  min-width: 15px;
  color: var(--color-text-muted);
}

.contact-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: var(--space-sm);
  border-top: 1px solid var(--color-border-light);
  margin-top: auto;
}

.contact-card-actions {
  display: flex;
  gap: var(--space-xs);
  opacity: 0;
  transition: opacity var(--transition-base);
}

.contact-card:hover .contact-card-actions {
  opacity: 1;
}

/* Contact Type Badge */
.contact-type-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.contact-type-badge--vendor {
  background: rgba(59, 130, 246, 0.1);
  color: #3b82f6;
}

.contact-type-badge--buyer {
  background: rgba(34, 197, 94, 0.1);
  color: #22c55e;
}

.contact-type-badge--tenant {
  background: rgba(245, 158, 11, 0.1);
  color: #f59e0b;
}

.contact-type-badge--landlord {
  background: rgba(139, 92, 246, 0.1);
  color: #8b5cf6;
}

[data-theme="dark"] .contact-type-badge--vendor {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
}

[data-theme="dark"] .contact-type-badge--buyer {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
}

[data-theme="dark"] .contact-type-badge--tenant {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
}

[data-theme="dark"] .contact-type-badge--landlord {
  background: rgba(139, 92, 246, 0.15);
  color: #a78bfa;
}

/* Contact Filter Tabs */
.contact-filter-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-2xl);
}

.contact-filter-tab {
  padding: 6px 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  background: var(--color-bg-card);
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-base);
  white-space: nowrap;
  font-family: var(--font-body);
}

.contact-filter-tab:hover {
  border-color: var(--rw-yellow);
  color: var(--color-text-primary);
}

.contact-filter-tab.active {
  background: var(--rw-yellow);
  border-color: var(--rw-yellow);
  color: var(--rw-black);
  font-weight: 600;
}

/* Contact Form */
.contact-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
  max-height: 65vh;
  overflow-y: auto;
  padding-right: 4px;
}

.contact-form-section {
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--color-border-light);
}

.contact-form-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.contact-form-section h4 {
  font-family: var(--font-heading);
  font-size: var(--text-base);
  font-weight: 600;
  margin-bottom: var(--space-md);
  color: var(--color-text-primary);
}

.contact-form .form-row {
  display: flex;
  gap: var(--space-md);
  flex-wrap: wrap;
}

.contact-form .form-row .form-group {
  flex: 1;
  min-width: 140px;
}

/* Responsive contacts */
@media (max-width: 767px) {
  .contacts-grid {
    grid-template-columns: 1fr;
    padding: 0 var(--space-lg) var(--space-lg);
  }

  .contact-filter-tabs {
    padding: var(--space-md) var(--space-lg);
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
  }
}


/* ================================================================
   SAVED OUTPUTS VIEW
   ================================================================ */

/* Saved Outputs Grid */
.saved-outputs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--space-lg);
  padding: 0 var(--space-2xl) var(--space-2xl);
}

/* Saved Output Card */
.saved-output-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  transition: all var(--transition-base);
  position: relative;
}

.saved-output-card:hover {
  border-color: var(--rw-yellow);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.saved-output-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-md);
}

.saved-output-title {
  font-family: var(--font-heading);
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--color-text-primary);
  line-height: 1.3;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.saved-output-delete {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  min-width: 28px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all var(--transition-base);
  padding: 0;
  opacity: 0;
  flex-shrink: 0;
}

.saved-output-card:hover .saved-output-delete {
  opacity: 1;
}

.saved-output-delete:hover {
  background: var(--color-error-bg);
  color: var(--color-error);
}

.saved-output-delete svg,
.saved-output-delete i {
  width: 15px;
  height: 15px;
}

.saved-output-tool-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  background: var(--rw-yellow-subtle);
  color: var(--rw-yellow-hover);
  white-space: nowrap;
}

.saved-output-tool-badge svg,
.saved-output-tool-badge i {
  width: 12px;
  height: 12px;
}

/* Output Content Preview */
.output-content-preview {
  max-height: 100px;
  overflow: hidden;
  position: relative;
  font-size: var(--text-sm);
  line-height: 1.6;
  color: var(--color-text-secondary);
}

.output-content-preview::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 40px;
  background: linear-gradient(to bottom, transparent, var(--color-bg-card));
  pointer-events: none;
}

[data-theme="dark"] .output-content-preview::after {
  background: linear-gradient(to bottom, transparent, var(--color-bg-card));
}

.saved-output-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: var(--space-sm);
  border-top: 1px solid var(--color-border-light);
  margin-top: auto;
}

.saved-output-date {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.saved-output-open {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--rw-yellow-hover);
  cursor: pointer;
  transition: color var(--transition-base);
}

.saved-output-open:hover {
  color: var(--rw-yellow);
}

/* Responsive saved outputs */
@media (max-width: 767px) {
  .saved-outputs-grid {
    grid-template-columns: 1fr;
    padding: 0 var(--space-lg) var(--space-lg);
  }
}


/* ================================================================
   PASSWORD CHANGE MODAL
   ================================================================ */
.password-change-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.password-change-form .form-group {
  margin-bottom: 0;
}

.password-change-form .form-group label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-primary);
  margin-bottom: var(--space-sm);
}

.password-change-form .input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.password-change-form .form-control {
  width: 100%;
  padding-right: 44px;
}

.password-change-form .password-toggle {
  position: absolute;
  right: 12px;
  padding: 4px;
  color: var(--color-text-muted);
  transition: color var(--transition-base);
  cursor: pointer;
  background: none;
  border: none;
}

.password-change-form .password-toggle:hover {
  color: var(--rw-yellow-hover);
}

.password-change-form .password-requirements {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  line-height: 1.5;
  margin-top: var(--space-xs);
}


/* ================================================================
   ENRICHMENT PANEL (Project Detail)
   ================================================================ */
.enrichment-panel {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  margin-bottom: var(--space-xl);
  position: relative;
  overflow: hidden;
}

.enrichment-panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--rw-yellow), #ffd700, var(--rw-yellow));
}

.enrichment-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
  gap: var(--space-md);
}

.enrichment-panel-title {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--color-text-primary);
}

.enrichment-panel-title svg,
.enrichment-panel-title i {
  width: 20px;
  height: 20px;
  color: var(--rw-yellow-hover);
}

.enrichment-content {
  font-size: var(--text-sm);
  line-height: 1.75;
  color: var(--color-text-primary);
}

.enrichment-content h1,
.enrichment-content h2,
.enrichment-content h3,
.enrichment-content h4 {
  font-family: var(--font-heading);
  margin-top: var(--space-lg);
  margin-bottom: var(--space-sm);
  color: var(--color-text-primary);
}

.enrichment-content h1 { font-size: var(--text-xl); }
.enrichment-content h2 { font-size: var(--text-lg); }
.enrichment-content h3 { font-size: var(--text-base); font-weight: 600; }

.enrichment-content p {
  margin-bottom: var(--space-sm);
}

.enrichment-content ul,
.enrichment-content ol {
  padding-left: 1.6em;
  margin: var(--space-sm) 0;
}

.enrichment-content ul { list-style-type: disc; }
.enrichment-content ol { list-style-type: decimal; }

.enrichment-content li {
  display: list-item;
  margin-bottom: 4px;
  line-height: 1.7;
}

.enrichment-content table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--space-md) 0;
  font-size: var(--text-sm);
}

.enrichment-content th,
.enrichment-content td {
  border: 1px solid var(--color-border);
  padding: 8px 12px;
  text-align: left;
}

.enrichment-content th {
  background: var(--color-bg-primary);
  font-weight: 700;
}

.enrichment-content strong {
  font-weight: 700;
  color: var(--color-text-primary);
}

.enrichment-content a {
  color: #3b82f6;
  text-decoration: underline;
}

[data-theme="dark"] .enrichment-content a {
  color: #60a5fa;
}

.enrichment-content blockquote {
  border-left: 3px solid var(--rw-yellow);
  padding: var(--space-sm) var(--space-md);
  margin: var(--space-md) 0;
  background: rgba(0, 0, 0, 0.02);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--color-text-secondary);
}

[data-theme="dark"] .enrichment-content blockquote {
  background: rgba(255, 255, 255, 0.03);
}

.enrichment-empty {
  text-align: center;
  padding: var(--space-xl);
  color: var(--color-text-muted);
}

.enrichment-empty svg,
.enrichment-empty i {
  width: 36px;
  height: 36px;
  margin-bottom: var(--space-sm);
  opacity: 0.4;
}

.enrichment-empty p {
  font-size: var(--text-sm);
  margin-bottom: var(--space-md);
}

/* Enrich Button */
.btn-enrich {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 8px 18px;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--rw-black);
  background: linear-gradient(135deg, var(--rw-yellow), #ffd700);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-base);
  box-shadow: 0 2px 8px rgba(255, 229, 18, 0.2);
  white-space: nowrap;
}

.btn-enrich:hover {
  background: linear-gradient(135deg, var(--rw-yellow-hover), #e6c200);
  box-shadow: var(--shadow-yellow);
  transform: translateY(-1px);
}

.btn-enrich:active {
  transform: translateY(0);
  box-shadow: 0 1px 4px rgba(255, 229, 18, 0.15);
}

.btn-enrich:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

.btn-enrich svg,
.btn-enrich i {
  width: 16px;
  height: 16px;
}

.btn-enrich .spinner {
  width: 16px;
  height: 16px;
  border-width: 2px;
}

[data-theme="dark"] .enrichment-panel {
  background: var(--color-bg-card);
  border-color: var(--color-border-light);
}

[data-theme="dark"] .enrichment-content th {
  background: var(--color-bg-secondary);
}


/* ================================================================
   PDF EXPORT & SAVE OUTPUT BUTTONS (Message Action Bar)
   ================================================================ */
.btn-export-pdf,
.btn-save-output {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-muted);
  background: transparent;
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-base);
  white-space: nowrap;
  font-family: var(--font-body);
}

.btn-export-pdf svg,
.btn-export-pdf i,
.btn-save-output svg,
.btn-save-output i {
  width: 13px;
  height: 13px;
}

.btn-export-pdf:hover {
  color: #dc2626;
  background: rgba(220, 38, 38, 0.06);
  border-color: rgba(220, 38, 38, 0.3);
}

.btn-save-output:hover {
  color: var(--color-success);
  background: rgba(34, 197, 94, 0.06);
  border-color: rgba(34, 197, 94, 0.3);
}

.btn-export-pdf:active,
.btn-save-output:active {
  transform: scale(0.96);
}

.btn-export-pdf.saved,
.btn-save-output.saved {
  color: var(--color-success);
  border-color: rgba(34, 197, 94, 0.3);
  background: rgba(34, 197, 94, 0.06);
}

[data-theme="dark"] .btn-export-pdf,
[data-theme="dark"] .btn-save-output {
  color: var(--color-text-muted);
  border-color: var(--color-border-light);
}

[data-theme="dark"] .btn-export-pdf:hover {
  color: #f87171;
  background: rgba(220, 38, 38, 0.08);
  border-color: rgba(220, 38, 38, 0.25);
}

[data-theme="dark"] .btn-save-output:hover {
  color: #4ade80;
  background: rgba(34, 197, 94, 0.08);
  border-color: rgba(34, 197, 94, 0.25);
}


/* ================================================================
   CONVERSATION TAGS
   ================================================================ */

/* Tags Container */
.tags-container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

/* Tag Chip */
.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  background: var(--rw-yellow-subtle);
  color: var(--rw-yellow-hover);
  border: 1px solid rgba(255, 229, 18, 0.15);
  white-space: nowrap;
  transition: all var(--transition-base);
  line-height: 1.6;
}

.tag-chip:hover {
  background: rgba(255, 229, 18, 0.15);
  border-color: rgba(255, 229, 18, 0.3);
}

.tag-chip-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: var(--radius-full);
  background: transparent;
  border: none;
  color: inherit;
  cursor: pointer;
  padding: 0;
  font-size: 14px;
  line-height: 1;
  opacity: 0.6;
  transition: opacity var(--transition-base);
}

.tag-chip-remove:hover {
  opacity: 1;
}

.tag-chip-remove svg,
.tag-chip-remove i {
  width: 10px;
  height: 10px;
}

/* Tag color variants */
.tag-chip--blue {
  background: rgba(59, 130, 246, 0.1);
  color: #3b82f6;
  border-color: rgba(59, 130, 246, 0.15);
}

.tag-chip--green {
  background: rgba(34, 197, 94, 0.1);
  color: #22c55e;
  border-color: rgba(34, 197, 94, 0.15);
}

.tag-chip--purple {
  background: rgba(139, 92, 246, 0.1);
  color: #8b5cf6;
  border-color: rgba(139, 92, 246, 0.15);
}

.tag-chip--orange {
  background: rgba(245, 158, 11, 0.1);
  color: #f59e0b;
  border-color: rgba(245, 158, 11, 0.15);
}

.tag-chip--red {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.15);
}

[data-theme="dark"] .tag-chip {
  background: rgba(255, 229, 18, 0.06);
  border-color: rgba(255, 229, 18, 0.12);
}

[data-theme="dark"] .tag-chip:hover {
  background: rgba(255, 229, 18, 0.12);
  border-color: rgba(255, 229, 18, 0.25);
}

[data-theme="dark"] .tag-chip--blue {
  background: rgba(59, 130, 246, 0.12);
  color: #60a5fa;
  border-color: rgba(59, 130, 246, 0.18);
}

[data-theme="dark"] .tag-chip--green {
  background: rgba(34, 197, 94, 0.12);
  color: #4ade80;
  border-color: rgba(34, 197, 94, 0.18);
}

[data-theme="dark"] .tag-chip--purple {
  background: rgba(139, 92, 246, 0.12);
  color: #a78bfa;
  border-color: rgba(139, 92, 246, 0.18);
}

[data-theme="dark"] .tag-chip--orange {
  background: rgba(245, 158, 11, 0.12);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.18);
}

[data-theme="dark"] .tag-chip--red {
  background: rgba(239, 68, 68, 0.12);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.18);
}

/* Tag Input */
.tag-input {
  display: inline-flex;
  align-items: center;
  min-width: 60px;
  max-width: 140px;
  padding: 2px 8px;
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-full);
  background: transparent;
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 500;
  color: var(--color-text-primary);
  outline: none;
  transition: all var(--transition-base);
  line-height: 1.6;
}

.tag-input::placeholder {
  color: var(--color-text-muted);
  font-style: italic;
}

.tag-input:focus {
  border-color: var(--rw-yellow);
  border-style: solid;
  background: var(--rw-yellow-subtle);
  box-shadow: 0 0 0 2px var(--rw-yellow-glow);
}

[data-theme="dark"] .tag-input {
  border-color: var(--color-border);
  color: var(--color-text-primary);
}

[data-theme="dark"] .tag-input:focus {
  border-color: var(--rw-yellow);
  background: rgba(255, 229, 18, 0.04);
}

/* Tags in history items */
.history-item-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.history-item-tags .tag-chip {
  padding: 1px 8px;
  font-size: 10px;
}

/* Tags in conversation header */
.chat-header-tags {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

/* Responsive tags */
@media (max-width: 767px) {
  .tags-container {
    gap: 4px;
  }

  .tag-chip {
    padding: 1px 8px;
    font-size: 10px;
  }

  .tag-input {
    max-width: 100px;
    font-size: 10px;
  }
}


/* ──────────────────────────────────────────────
   ANALYTICS DASHBOARD
   ────────────────────────────────────────────── */

.analytics-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.analytics-stat-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 16px;
  background: var(--color-bg-input-light, #f8f8f8);
  border-radius: 12px;
  border: 1px solid var(--color-border, #e5e5e5);
}

.analytics-stat-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: rgba(255, 229, 18, 0.12);
  color: #c5a800;
  flex-shrink: 0;
}

.analytics-stat-icon svg {
  width: 22px;
  height: 22px;
}

.analytics-stat-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.analytics-stat-number {
  font-family: 'Playfair Display', serif;
  font-size: 26px;
  font-weight: 700;
  line-height: 1.1;
  color: var(--color-text-primary, #1a1a1a);
}

.analytics-stat-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text-secondary, #666);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* Chart rows */
.analytics-charts-row {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 20px;
  margin-bottom: 20px;
}

.analytics-bottom-row {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 20px;
}

.analytics-chart-wrapper {
  background: var(--color-bg-input-light, #f8f8f8);
  border: 1px solid var(--color-border, #e5e5e5);
  border-radius: 12px;
  padding: 18px;
  position: relative;
}

.analytics-chart-title {
  font-family: 'Playfair Display', serif;
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text-primary, #1a1a1a);
  margin: 0 0 14px 0;
}

.analytics-chart-container {
  position: relative;
  height: 280px;
}

/* Leaderboard table */
.analytics-leaderboard-container {
  max-height: 340px;
  overflow-y: auto;
}

.analytics-leaderboard {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.analytics-leaderboard thead th {
  text-align: left;
  padding: 8px 10px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--color-text-secondary, #666);
  border-bottom: 2px solid var(--color-border, #e5e5e5);
  position: sticky;
  top: 0;
  background: var(--color-bg-input-light, #f8f8f8);
  z-index: 1;
}

.analytics-leaderboard tbody td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--color-border, #e5e5e5);
  color: var(--color-text-primary, #1a1a1a);
}

.analytics-leaderboard tbody tr:last-child td {
  border-bottom: none;
}

.analytics-leaderboard tbody tr:hover {
  background: var(--color-bg-hover, #f0f0f0);
}

/* Rank badges */
.leaderboard-rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  background: var(--color-bg-hover, #eee);
  color: var(--color-text-secondary, #666);
}

.leaderboard-rank--top {
  background: rgba(255, 229, 18, 0.15);
  color: #b8960a;
  font-size: 18px;
}

/* Responsive: tablets */
@media (max-width: 1024px) {
  .analytics-charts-row,
  .analytics-bottom-row {
    grid-template-columns: 1fr;
  }
}

/* Responsive: mobile */
@media (max-width: 768px) {
  .analytics-stats {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .analytics-stats {
    grid-template-columns: 1fr;
  }

  .analytics-stat-card {
    padding: 14px 12px;
  }

  .analytics-stat-number {
    font-size: 22px;
  }

  .analytics-chart-container {
    height: 220px;
  }
}

/* Dark mode overrides for analytics */
[data-theme="dark"] .analytics-stat-card {
  background: var(--color-bg-card);
  border-color: var(--color-border);
}

[data-theme="dark"] .analytics-stat-icon {
  background: rgba(255, 229, 18, 0.08);
  color: #FFE512;
}

[data-theme="dark"] .analytics-chart-wrapper {
  background: var(--color-bg-card);
  border-color: var(--color-border);
}

[data-theme="dark"] .leaderboard-rank--top {
  background: rgba(255, 229, 18, 0.1);
  color: #FFE512;
}

[data-theme="dark"] .analytics-leaderboard thead th {
  background: var(--color-bg-card);
  border-bottom-color: var(--color-border);
}

[data-theme="dark"] .analytics-leaderboard tbody td {
  border-bottom-color: var(--color-border);
}

[data-theme="dark"] .analytics-leaderboard tbody tr:hover {
  background: var(--color-bg-hover);
}


/* ──────────────────────────────────────────────
   DOCUMENT EXPORT BUTTONS
   ────────────────────────────────────────────── */

.action-btn.word-btn {
  color: #2b579a;
  border-color: #2b579a33;
}

.action-btn.word-btn:hover {
  background: #2b579a15;
  border-color: #2b579a;
  color: #2b579a;
}

.action-btn.excel-btn {
  color: #217346;
  border-color: #21734633;
}

.action-btn.excel-btn:hover {
  background: #21734615;
  border-color: #217346;
  color: #217346;
}

.action-btn:disabled {
  opacity: 0.6;
  cursor: wait;
}

[data-theme="dark"] .action-btn.word-btn {
  color: #5b9bd5;
  border-color: #5b9bd533;
}

[data-theme="dark"] .action-btn.word-btn:hover {
  background: #5b9bd520;
  border-color: #5b9bd5;
  color: #5b9bd5;
}

[data-theme="dark"] .action-btn.excel-btn {
  color: #70ad47;
  border-color: #70ad4733;
}

[data-theme="dark"] .action-btn.excel-btn:hover {
  background: #70ad4720;
  border-color: #70ad47;
  color: #70ad47;
}


/* ──────────────────────────────────────────────
   LIVE INSIGHTS WIDGETS
   ────────────────────────────────────────────── */

.section-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(34, 197, 94, 0.1);
  color: #22c55e;
  border: 1px solid rgba(34, 197, 94, 0.2);
  animation: pulse-badge 2s ease-in-out infinite;
}

@keyframes pulse-badge {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* Widget rows */
.widgets-row {
  display: grid;
  gap: 16px;
  margin-bottom: 16px;
}

.widgets-row--top {
  grid-template-columns: 1fr 1.3fr 0.8fr;
}

.widgets-row--bottom {
  grid-template-columns: 1fr 1fr 1fr;
}

.widgets-row--qr {
  grid-template-columns: 1fr;
}

/* Widget card base */
.widget-card {
  background: var(--color-bg-input-light, #f8f8f8);
  border: 1px solid var(--color-border, #e5e5e5);
  border-radius: 14px;
  overflow: hidden;
  transition: box-shadow 0.2s, border-color 0.2s;
}

.widget-card:hover {
  border-color: var(--rw-yellow);
  box-shadow: var(--shadow-md);
}

.widget-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: var(--color-bg-hover, #f0f0f0);
  border-bottom: 1px solid var(--color-border, #e5e5e5);
  font-size: 13px;
  font-weight: 700;
  color: var(--color-text-primary);
}

.widget-header svg {
  width: 16px;
  height: 16px;
  color: var(--rw-yellow-dark, #c5a800);
}

.widget-hint {
  margin-left: auto;
  font-weight: 400;
  font-size: 11px;
  color: var(--color-text-secondary);
}

.widget-body {
  padding: 14px 16px;
}

/* ── Weather Widget ── */
.weather-main {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 12px;
}

.weather-temp {
  font-family: 'Playfair Display', serif;
  font-size: 40px;
  font-weight: 700;
  line-height: 1;
  color: var(--color-text-primary);
}

.weather-desc {
  font-size: 14px;
  color: var(--color-text-secondary);
}

.weather-details {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 12px;
}

.weather-detail {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--color-text-secondary);
}

.weather-detail svg {
  width: 13px;
  height: 13px;
  color: var(--rw-yellow-dark, #c5a800);
}

.weather-forecast {
  display: flex;
  gap: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--color-border, #e5e5e5);
}

.forecast-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  flex: 1;
}

.forecast-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-secondary);
}

.forecast-icon {
  font-size: 20px;
  line-height: 1;
}

.forecast-temps {
  font-size: 11px;
  color: var(--color-text-primary);
  font-weight: 500;
}

/* ── Quote Widget ── */
.widget-quote .widget-body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 120px;
}

.quote-text {
  font-family: 'Playfair Display', serif;
  font-size: 15px;
  font-style: italic;
  line-height: 1.6;
  color: var(--color-text-primary);
  border-left: 3px solid var(--rw-yellow);
  padding-left: 14px;
  margin: 0 0 10px 0;
}

.quote-author {
  font-size: 12px;
  color: var(--color-text-secondary);
  font-style: normal;
  font-weight: 600;
  padding-left: 14px;
}

/* ── Holidays Widget ── */
.holidays-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.holidays-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px solid var(--color-border, #eee);
  font-size: 12px;
}

.holidays-list li:last-child {
  border-bottom: none;
}

.holiday-date {
  font-weight: 700;
  color: var(--rw-yellow-dark, #c5a800);
  min-width: 52px;
  font-size: 11px;
}

.holiday-name {
  color: var(--color-text-primary);
  flex: 1;
}

.holiday-soon {
  padding: 1px 7px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
  background: rgba(255, 229, 18, 0.15);
  color: #b8960a;
}

/* ── Mortgage Calculator Widget ── */
.mortgage-inputs {
  display: grid;
  grid-template-columns: 1fr 0.7fr 0.6fr;
  gap: 10px;
  margin-bottom: 14px;
}

.mortgage-field label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-secondary);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.mortgage-input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--color-border, #ddd);
  border-radius: 8px;
  font-size: 13px;
  font-family: 'Lato', sans-serif;
  background: var(--rw-white, #fff);
  color: var(--color-text-primary);
  box-sizing: border-box;
}

.mortgage-input:focus {
  outline: none;
  border-color: var(--rw-yellow);
  box-shadow: 0 0 0 2px rgba(255, 229, 18, 0.2);
}

.mortgage-results {
  background: var(--color-bg-hover, #f0f0f0);
  border-radius: 10px;
  padding: 14px;
}

.mortgage-result-main {
  text-align: center;
  margin-bottom: 10px;
}

.mortgage-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-text-secondary);
  margin-bottom: 2px;
}

.mortgage-value {
  font-family: 'Playfair Display', serif;
  font-size: 32px;
  font-weight: 700;
  color: var(--rw-yellow-dark, #c5a800);
}

.mortgage-result-row {
  display: flex;
  justify-content: space-around;
  gap: 8px;
}

.mortgage-result-item {
  text-align: center;
}

.mortgage-sub-label {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--color-text-secondary);
}

.mortgage-sub-value {
  font-size: 14px;
  font-weight: 700;
  color: var(--color-text-primary);
}

/* ── Currency Widget ── */
.currency-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 12px;
}

.currency-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-radius: 8px;
  background: var(--color-bg-hover, #f0f0f0);
  font-size: 12px;
}

.currency-flag {
  font-size: 10px;
  font-weight: 800;
  background: var(--rw-black, #080000);
  color: var(--rw-yellow);
  padding: 2px 4px;
  border-radius: 3px;
  min-width: 18px;
  text-align: center;
}

.currency-code {
  font-weight: 600;
  color: var(--color-text-secondary);
  font-size: 11px;
}

.currency-rate {
  margin-left: auto;
  font-weight: 700;
  color: var(--color-text-primary);
  font-family: 'Lato', sans-serif;
}

.currency-convert {
  display: flex;
  gap: 8px;
  align-items: center;
  padding-top: 10px;
  border-top: 1px solid var(--color-border, #e5e5e5);
}

.currency-convert .mortgage-input {
  flex: 1;
  min-width: 0;
}

.currency-convert select.mortgage-input {
  flex: 0 0 70px;
}

.currency-result {
  font-weight: 700;
  font-size: 13px;
  color: var(--rw-yellow-dark, #c5a800);
  white-space: nowrap;
  min-width: 100px;
  text-align: right;
}

/* ── Property Sales Widget ── */
.sales-search {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.sales-search .mortgage-input {
  flex: 1;
}

.sales-count {
  font-size: 12px;
  color: var(--color-text-secondary);
  margin-bottom: 8px;
}

.sales-table-wrap {
  max-height: 240px;
  overflow-y: auto;
  border-radius: 8px;
  border: 1px solid var(--color-border, #e5e5e5);
}

.sales-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.sales-table thead th {
  padding: 7px 8px;
  text-align: left;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--rw-yellow);
  background: var(--rw-black, #080000);
  position: sticky;
  top: 0;
  z-index: 1;
}

.sales-table tbody td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--color-border, #eee);
  color: var(--color-text-primary);
}

.sales-table tbody tr:hover {
  background: var(--color-bg-hover, #f8f8f8);
}

.sales-price {
  font-weight: 700;
  color: var(--rw-yellow-dark, #c5a800);
  white-space: nowrap;
}

.sales-source {
  font-size: 10px;
  color: var(--color-text-tertiary);
  margin-top: 8px;
  text-align: right;
  font-style: italic;
}

/* ── QR Code Widget ── */
.widget-qr-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.qr-input-row {
  display: flex;
  gap: 8px;
}

.qr-output {
  text-align: center;
  min-height: 40px;
}

.qr-result {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  justify-content: center;
}

.qr-image {
  width: 160px;
  height: 160px;
  border-radius: 10px;
  border: 2px solid var(--color-border, #ddd);
  background: #fff;
}

.qr-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.qr-url-preview {
  width: 100%;
  font-size: 11px;
  color: var(--color-text-secondary);
  margin-top: 8px;
  word-break: break-all;
}

/* ── Widget Responsive ── */
@media (max-width: 1024px) {
  .widgets-row--top,
  .widgets-row--bottom {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 768px) {
  .widgets-row--top,
  .widgets-row--bottom {
    grid-template-columns: 1fr;
  }

  .mortgage-inputs {
    grid-template-columns: 1fr;
  }

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

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

/* ── Widget Dark Mode ── */
[data-theme="dark"] .widget-card {
  background: var(--color-bg-card);
  border-color: var(--color-border);
}

[data-theme="dark"] .widget-header {
  background: var(--color-bg-secondary);
  border-bottom-color: var(--color-border);
}

[data-theme="dark"] .widget-header svg {
  color: #FFE512;
}

[data-theme="dark"] .mortgage-input {
  background: var(--color-bg-input);
  border-color: var(--color-border);
  color: var(--color-text-primary);
}

[data-theme="dark"] .mortgage-results {
  background: var(--color-bg-secondary);
}

[data-theme="dark"] .mortgage-value {
  color: #FFE512;
}

[data-theme="dark"] .currency-item {
  background: var(--color-bg-secondary);
}

[data-theme="dark"] .currency-flag {
  background: #FFE512;
  color: #080000;
}

[data-theme="dark"] .currency-result {
  color: #FFE512;
}

[data-theme="dark"] .holiday-soon {
  background: rgba(255, 229, 18, 0.1);
  color: #FFE512;
}

[data-theme="dark"] .holiday-date {
  color: #FFE512;
}

[data-theme="dark"] .sales-price {
  color: #FFE512;
}

[data-theme="dark"] .section-badge {
  background: rgba(34, 197, 94, 0.08);
}

[data-theme="dark"] .qr-image {
  border-color: var(--color-border);
}


/* ----------------------------------------------------------------
   PROPERTY MAP VIEW
   ---------------------------------------------------------------- */

.map-view-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 60px);
  position: relative;
}

.map-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--color-bg-card);
  border-bottom: 1px solid var(--color-border);
  z-index: 500;
  flex-wrap: wrap;
}

.map-search-wrapper {
  position: relative;
  flex: 1;
  min-width: 240px;
  max-width: 500px;
}

.map-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--color-text-muted);
  pointer-events: none;
}

.map-search-input {
  width: 100%;
  padding: 10px 14px 10px 38px;
  font-size: 14px;
  font-family: 'Lato', sans-serif;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-bg-card);
  color: var(--color-text-primary);
  transition: border-color 0.2s;
}

.map-search-input:focus {
  outline: none;
  border-color: var(--rw-yellow);
  box-shadow: 0 0 0 3px var(--rw-yellow-glow);
}

.map-search-results {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  max-height: 280px;
  overflow-y: auto;
  z-index: 600;
}

.map-search-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  font-size: 13px;
  color: var(--color-text-primary);
  border-bottom: 1px solid var(--color-border-light);
  transition: background 0.15s;
}

.map-search-item:last-child {
  border-bottom: none;
}

.map-search-item:hover {
  background: var(--rw-yellow-subtle);
}

.map-search-empty {
  color: var(--color-text-muted);
  cursor: default;
  justify-content: center;
}

.map-layer-toggles {
  display: flex;
  gap: 6px;
}

.map-layer-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-bg-card);
  color: var(--color-text-secondary);
  font-size: 12px;
  font-family: 'Lato', sans-serif;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.map-layer-btn svg {
  width: 14px;
  height: 14px;
}

.map-layer-btn:hover {
  border-color: var(--rw-yellow);
  color: var(--color-text-primary);
}

.map-layer-btn.active {
  background: var(--rw-yellow);
  color: var(--rw-black);
  border-color: var(--rw-yellow);
}

/* Map container */
.property-map-container {
  flex: 1;
  min-height: 400px;
  z-index: 1;
}

/* Custom map marker */
.map-marker-custom {
  background: none !important;
  border: none !important;
}

.map-marker-pin {
  width: 32px;
  height: 42px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 4px;
}

.map-marker-pin svg {
  width: 28px;
  height: 28px;
  color: var(--rw-yellow);
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.4));
  fill: var(--rw-yellow);
  stroke: #080000;
  stroke-width: 1.5;
}

/* Amenity dot markers */
.map-amenity-marker {
  background: none !important;
  border: none !important;
}

.map-amenity-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

/* Map Info Panel */
.map-info-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 360px;
  background: var(--color-bg-card);
  border-left: 1px solid var(--color-border);
  z-index: 500;
  display: flex;
  flex-direction: column;
  box-shadow: -4px 0 16px rgba(0,0,0,0.08);
  overflow: hidden;
}

.map-info-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--color-border);
  gap: 10px;
}

.map-info-header h3 {
  font-family: 'Playfair Display', serif;
  font-size: 15px;
  font-weight: 600;
  margin: 0;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.map-info-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.map-info-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 0;
  color: var(--color-text-muted);
  font-size: 13px;
}

.map-info-coords {
  display: flex;
  gap: 16px;
  padding: 10px 12px;
  background: var(--color-bg-primary);
  border-radius: 8px;
  font-size: 12px;
  color: var(--color-text-secondary);
  margin-bottom: 16px;
}

.map-info-section {
  margin-bottom: 20px;
}

.map-info-section h4 {
  font-family: 'Playfair Display', serif;
  font-size: 13px;
  font-weight: 600;
  margin: 0 0 10px 0;
  color: var(--color-text-primary);
  padding-bottom: 6px;
  border-bottom: 1px solid var(--color-border-light);
}

.map-amenity-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.map-amenity-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 6px;
  background: var(--color-bg-primary);
  border-radius: 8px;
  text-align: center;
  gap: 4px;
}

.map-amenity-item svg {
  width: 16px;
  height: 16px;
  color: var(--rw-yellow);
}

.map-amenity-count {
  font-size: 18px;
  font-weight: 700;
  color: var(--color-text-primary);
  line-height: 1;
}

.map-amenity-label {
  font-size: 10px;
  color: var(--color-text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

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

.map-places-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  font-size: 12px;
  color: var(--color-text-primary);
  border-bottom: 1px solid var(--color-border-light);
}

.map-places-list li:last-child {
  border-bottom: none;
}

.map-places-list li small {
  margin-left: auto;
  color: var(--color-text-muted);
  font-size: 10px;
  white-space: nowrap;
}

.map-places-list li svg {
  color: var(--rw-yellow);
  flex-shrink: 0;
}

/* Sales in info panel */
.map-sales-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.map-sale-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 10px;
  padding: 8px 10px;
  background: var(--color-bg-primary);
  border-radius: 6px;
  font-size: 12px;
}

.map-sale-address {
  color: var(--color-text-primary);
  font-weight: 500;
  grid-column: 1;
}

.map-sale-price {
  color: var(--color-success);
  font-weight: 700;
  grid-column: 2;
  grid-row: 1 / 3;
  align-self: center;
}

.map-sale-date {
  color: var(--color-text-muted);
  font-size: 11px;
  grid-column: 1;
}

/* Info panel action buttons */
.map-info-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--color-border-light);
}

.map-info-actions .btn {
  flex: 1;
  font-size: 12px;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .map-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .map-search-wrapper {
    max-width: 100%;
  }

  .map-layer-toggles {
    flex-wrap: wrap;
  }

  .map-layer-btn span {
    display: none;
  }

  .map-info-panel {
    width: 100%;
    height: 50%;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    border-left: none;
    border-top: 1px solid var(--color-border);
  }
}

/* ── Dark Mode ── */
[data-theme="dark"] .map-controls {
  background: var(--color-bg-card);
  border-bottom-color: var(--color-border);
}

[data-theme="dark"] .map-search-input {
  background: var(--color-bg-input);
  border-color: var(--color-border);
  color: var(--color-text-primary);
}

[data-theme="dark"] .map-search-results {
  background: var(--color-bg-card);
  border-color: var(--color-border);
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

[data-theme="dark"] .map-search-item {
  color: var(--color-text-primary);
  border-bottom-color: var(--color-border);
}

[data-theme="dark"] .map-search-item:hover {
  background: rgba(255, 229, 18, 0.08);
}

[data-theme="dark"] .map-layer-btn {
  background: var(--color-bg-secondary);
  border-color: var(--color-border);
  color: var(--color-text-secondary);
}

[data-theme="dark"] .map-layer-btn.active {
  background: var(--rw-yellow);
  color: var(--rw-black);
  border-color: var(--rw-yellow);
}

[data-theme="dark"] .map-info-panel {
  background: var(--color-bg-card);
  border-left-color: var(--color-border);
}

[data-theme="dark"] .map-info-header {
  border-bottom-color: var(--color-border);
}

[data-theme="dark"] .map-info-coords {
  background: var(--color-bg-secondary);
}

[data-theme="dark"] .map-info-section h4 {
  border-bottom-color: var(--color-border);
}

[data-theme="dark"] .map-amenity-item {
  background: var(--color-bg-secondary);
}

[data-theme="dark"] .map-sale-item {
  background: var(--color-bg-secondary);
}

[data-theme="dark"] .map-sale-price {
  color: #FFE512;
}

[data-theme="dark"] .map-info-actions {
  border-top-color: var(--color-border);
}

/* Leaflet popup styling overrides */
.leaflet-popup-content-wrapper {
  border-radius: 8px;
  font-family: 'Lato', sans-serif;
  font-size: 13px;
}

.leaflet-popup-content {
  margin: 10px 14px;
}

[data-theme="dark"] .leaflet-popup-content-wrapper {
  background: #1a1a1a;
  color: #e0e0e0;
}

[data-theme="dark"] .leaflet-popup-tip {
  background: #1a1a1a;
}


/* ================================================================
   PIPELINE / KANBAN BOARD
   ================================================================ */

/* Pipeline Header Actions */
.pipeline-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.pipeline-type-filters {
  display: flex;
  gap: 4px;
  background: var(--color-border-light);
  border-radius: 8px;
  padding: 3px;
}

.pipeline-type-btn {
  padding: 6px 14px;
  border: none;
  background: transparent;
  color: var(--color-text-secondary);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.pipeline-type-btn:hover {
  color: var(--color-text-primary);
  background: rgba(0, 0, 0, 0.04);
}

.pipeline-type-btn.active {
  background: var(--rw-yellow);
  color: var(--rw-black);
  box-shadow: var(--shadow-xs);
}

/* Pipeline Stats Bar */
.pipeline-stats {
  display: flex;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.pipeline-stat-card {
  flex: 1;
  min-width: 160px;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.pipeline-stat-label {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-text-muted);
}

.pipeline-stat-value {
  font-family: var(--font-heading);
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--color-text-primary);
}

/* Kanban Board */
.pipeline-board {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 16px;
  min-height: 400px;
  -webkit-overflow-scrolling: touch;
}

.pipeline-board::-webkit-scrollbar {
  height: 6px;
}

.pipeline-board::-webkit-scrollbar-track {
  background: var(--color-border-light);
  border-radius: 3px;
}

.pipeline-board::-webkit-scrollbar-thumb {
  background: var(--color-text-muted);
  border-radius: 3px;
}

/* Pipeline Column */
.pipeline-column {
  flex: 0 0 260px;
  min-width: 260px;
  background: var(--color-bg-primary);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 320px);
}

.pipeline-column-header {
  padding: 12px 14px;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: 10px 10px 0 0;
  position: sticky;
  top: 0;
  z-index: 1;
}

.pipeline-column-title {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.pipeline-column-title .stage-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.pipeline-column-count {
  background: var(--color-border-light);
  color: var(--color-text-secondary);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  min-width: 22px;
  text-align: center;
}

.pipeline-column-body {
  padding: 8px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 60px;
}

.pipeline-column-body::-webkit-scrollbar {
  width: 4px;
}

.pipeline-column-body::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 2px;
}

/* Drop zone highlighting */
.pipeline-column-body.drag-over {
  background: var(--rw-yellow-subtle);
  border: 2px dashed var(--rw-yellow);
  border-radius: 6px;
}

/* Stage colors */
.stage-lead .stage-dot { background: #9ca3af; }
.stage-appraisal .stage-dot { background: #3b82f6; }
.stage-listed .stage-dot { background: #eab308; }
.stage-under_offer .stage-dot { background: #f97316; }
.stage-exchanged .stage-dot { background: #22c55e; }
.stage-settled .stage-dot { background: #059669; }
.stage-withdrawn .stage-dot { background: #ef4444; }

.stage-lead .pipeline-column-header { border-left: 3px solid #9ca3af; }
.stage-appraisal .pipeline-column-header { border-left: 3px solid #3b82f6; }
.stage-listed .pipeline-column-header { border-left: 3px solid #eab308; }
.stage-under_offer .pipeline-column-header { border-left: 3px solid #f97316; }
.stage-exchanged .pipeline-column-header { border-left: 3px solid #22c55e; }
.stage-settled .pipeline-column-header { border-left: 3px solid #059669; }

/* Pipeline Card */
.pipeline-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 12px;
  cursor: grab;
  transition: box-shadow 0.2s ease, transform 0.15s ease, border-color 0.2s ease;
  user-select: none;
}

.pipeline-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--rw-yellow-hover);
}

.pipeline-card:active {
  cursor: grabbing;
}

.pipeline-card.dragging {
  opacity: 0.5;
  transform: rotate(2deg);
  box-shadow: var(--shadow-lg);
}

.pipeline-card-title {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--color-text-primary);
  margin-bottom: 6px;
  line-height: 1.3;
}

.pipeline-card-address {
  font-size: 12px;
  color: var(--color-text-secondary);
  margin-bottom: 6px;
  display: flex;
  align-items: flex-start;
  gap: 4px;
}

.pipeline-card-address i {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  margin-top: 1px;
}

.pipeline-card-price {
  font-family: var(--font-heading);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-primary);
  margin-bottom: 6px;
}

.pipeline-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--color-text-muted);
  gap: 6px;
}

.pipeline-card-contact {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--color-text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 140px;
}

.pipeline-card-contact i {
  width: 11px;
  height: 11px;
  flex-shrink: 0;
}

.pipeline-card-days {
  font-size: 11px;
  color: var(--color-text-muted);
  white-space: nowrap;
}

.pipeline-card-type {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 6px;
  border-radius: 4px;
  margin-bottom: 6px;
}

.pipeline-card-type.type-sale {
  background: #dbeafe;
  color: #1d4ed8;
}

.pipeline-card-type.type-rental {
  background: #fef3c7;
  color: #92400e;
}

.pipeline-card-type.type-commercial {
  background: #e0e7ff;
  color: #4338ca;
}

.pipeline-card-actions {
  display: flex;
  gap: 2px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--color-border-light);
}

.pipeline-card-actions .btn {
  padding: 3px 6px;
  font-size: 11px;
}

.pipeline-card-actions .btn i {
  width: 12px;
  height: 12px;
}

/* Withdrawn section */
.pipeline-withdrawn-section {
  margin-top: 20px;
  border-top: 1px solid var(--color-border);
  padding-top: 12px;
}

.pipeline-withdrawn-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  color: var(--color-text-secondary);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  padding: 8px 0;
}

.pipeline-withdrawn-toggle:hover {
  color: var(--color-text-primary);
}

.pipeline-withdrawn-toggle i {
  width: 16px;
  height: 16px;
  transition: transform 0.2s ease;
}

.pipeline-withdrawn-toggle.expanded i {
  transform: rotate(180deg);
}

.pipeline-withdrawn-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 10px;
  padding: 10px 0;
}

.pipeline-withdrawn-list .pipeline-card {
  cursor: default;
  opacity: 0.7;
}

.pipeline-withdrawn-list .pipeline-card:hover {
  opacity: 1;
}

/* Pipeline empty column */
.pipeline-column-empty {
  text-align: center;
  padding: 20px 10px;
  color: var(--color-text-muted);
  font-size: 12px;
  font-style: italic;
}

/* ── Deal Activity Timeline ── */

.deal-activity-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 300px;
}

.deal-activity-header {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--color-border-light);
}

.deal-activity-deal-info {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.deal-activity-stage {
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--color-text-primary);
}

.deal-activity-price {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.deal-activity-add {
  background: var(--color-bg-secondary);
  border-radius: var(--radius-md);
  padding: 12px;
}

.deal-activity-add .form-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.deal-activity-add .form-input-sm {
  padding: 6px 10px;
  font-size: var(--text-sm);
  height: 34px;
}

.deal-activity-timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
  max-height: 400px;
  overflow-y: auto;
  padding-right: 4px;
}

.deal-activity-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 40px 20px;
  color: var(--color-text-muted);
  text-align: center;
}

.deal-activity-empty i,
.deal-activity-empty svg {
  width: 32px;
  height: 32px;
  opacity: 0.4;
}

.deal-activity-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--color-border-light);
  position: relative;
}

.deal-activity-item:last-child {
  border-bottom: none;
}

.deal-activity-item--system {
  opacity: 0.7;
}

.deal-activity-item-dot {
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
}

.deal-activity-item-dot i,
.deal-activity-item-dot svg {
  width: 16px;
  height: 16px;
}

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

.deal-activity-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.deal-activity-item-type {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.deal-activity-item-time {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  white-space: nowrap;
}

.deal-activity-item-text {
  font-size: var(--text-sm);
  color: var(--color-text-primary);
  line-height: 1.5;
  word-break: break-word;
}

.deal-activity-item-user {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-top: 2px;
}

.deal-activity-delete-btn {
  opacity: 0;
  transition: opacity var(--transition-base);
  flex-shrink: 0;
  align-self: center;
}

.deal-activity-item:hover .deal-activity-delete-btn {
  opacity: 1;
}

/* Deal Form Specific Styles */
.deal-form .form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.deal-form .form-group {
  margin-bottom: 12px;
}

.deal-form .form-label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-secondary);
  margin-bottom: 4px;
  display: block;
}

.deal-form .form-input,
.deal-form .form-select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  background: var(--color-bg-secondary);
  color: var(--color-text-primary);
  transition: border-color 0.2s;
}

.deal-form .form-input:focus,
.deal-form .form-select:focus {
  outline: none;
  border-color: var(--rw-yellow);
  box-shadow: 0 0 0 2px var(--rw-yellow-glow);
}

.deal-form textarea.form-input {
  resize: vertical;
  min-height: 60px;
}

/* Pipeline Dashboard Widget */
.pipeline-widget {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 16px;
}

.pipeline-widget-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.pipeline-widget-header h3 {
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--color-text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.pipeline-widget-header h3 i {
  width: 18px;
  height: 18px;
  color: var(--rw-yellow);
}

.pipeline-widget-bar {
  display: flex;
  height: 28px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--color-border-light);
  margin-bottom: 10px;
}

.pipeline-widget-bar-segment {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  transition: width 0.3s ease;
  min-width: 0;
  overflow: hidden;
}

.pipeline-widget-bar-segment.seg-lead { background: #9ca3af; }
.pipeline-widget-bar-segment.seg-appraisal { background: #3b82f6; }
.pipeline-widget-bar-segment.seg-listed { background: #eab308; color: #1a1a1a; }
.pipeline-widget-bar-segment.seg-under_offer { background: #f97316; }
.pipeline-widget-bar-segment.seg-exchanged { background: #22c55e; }
.pipeline-widget-bar-segment.seg-settled { background: #059669; }

.pipeline-widget-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 11px;
  color: var(--color-text-secondary);
}

.pipeline-widget-legend-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

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

.pipeline-widget-stats {
  display: flex;
  gap: 16px;
  margin-top: 10px;
  font-size: var(--text-sm);
}

.pipeline-widget-stats span {
  color: var(--color-text-secondary);
}

.pipeline-widget-stats strong {
  color: var(--color-text-primary);
}

/* ── Dark Mode Overrides for Pipeline ── */
[data-theme="dark"] .pipeline-type-filters {
  background: #222;
}

[data-theme="dark"] .pipeline-type-btn {
  color: #aaa;
}

[data-theme="dark"] .pipeline-type-btn:hover {
  color: #ddd;
  background: rgba(255,255,255,0.06);
}

[data-theme="dark"] .pipeline-type-btn.active {
  background: var(--rw-yellow);
  color: var(--rw-black);
}

[data-theme="dark"] .pipeline-stat-card {
  background: #1a1a1a;
  border-color: #333;
}

[data-theme="dark"] .pipeline-stat-value {
  color: #e0e0e0;
}

[data-theme="dark"] .pipeline-column {
  background: #111;
  border-color: #333;
}

[data-theme="dark"] .pipeline-column-header {
  border-bottom-color: #333;
}

[data-theme="dark"] .pipeline-column-count {
  background: #333;
  color: #aaa;
}

[data-theme="dark"] .pipeline-card {
  background: #1a1a1a;
  border-color: #333;
}

[data-theme="dark"] .pipeline-card:hover {
  border-color: var(--rw-yellow-hover);
}

[data-theme="dark"] .pipeline-card-title {
  color: #e0e0e0;
}

[data-theme="dark"] .pipeline-card-price {
  color: #e0e0e0;
}

[data-theme="dark"] .pipeline-card-type.type-sale {
  background: #1e3a5f;
  color: #93c5fd;
}

[data-theme="dark"] .pipeline-card-type.type-rental {
  background: #422006;
  color: #fcd34d;
}

[data-theme="dark"] .pipeline-card-type.type-commercial {
  background: #312e81;
  color: #c7d2fe;
}

[data-theme="dark"] .pipeline-card-actions {
  border-top-color: #333;
}

[data-theme="dark"] .pipeline-column-body.drag-over {
  background: rgba(255, 229, 18, 0.08);
  border-color: var(--rw-yellow);
}

[data-theme="dark"] .pipeline-widget {
  background: #1a1a1a;
  border-color: #333;
}

[data-theme="dark"] .pipeline-widget-bar {
  background: #333;
}

[data-theme="dark"] .pipeline-withdrawn-section {
  border-top-color: #333;
}

[data-theme="dark"] .deal-form .form-input,
[data-theme="dark"] .deal-form .form-select {
  background: #111;
  border-color: #333;
  color: #e0e0e0;
}

[data-theme="dark"] .deal-activity-add {
  background: #111;
}

[data-theme="dark"] .deal-activity-item {
  border-bottom-color: #333;
}

[data-theme="dark"] .deal-activity-item-text {
  color: #e0e0e0;
}

[data-theme="dark"] .deal-activity-header {
  border-bottom-color: #333;
}

/* ── Responsive: Stack columns vertically on mobile ── */
@media (max-width: 768px) {
  .pipeline-board {
    flex-direction: column;
  }

  .pipeline-column {
    flex: 1 1 auto;
    min-width: 100%;
    max-height: none;
  }

  .pipeline-stats {
    flex-direction: column;
  }

  .pipeline-header-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .pipeline-type-filters {
    justify-content: center;
  }

  .pipeline-withdrawn-list {
    grid-template-columns: 1fr;
  }

  .deal-activity-add .form-row {
    flex-direction: column;
  }

  .deal-activity-item-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }
}


/* ================================================================
   TASKS & REMINDERS
   ================================================================ */

/* Task Filter Tabs */
.task-filter-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-2xl);
}

.task-filter-tab {
  padding: 6px 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  background: var(--color-bg-card);
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-base);
  white-space: nowrap;
  font-family: var(--font-body);
}

.task-filter-tab:hover {
  border-color: var(--rw-yellow);
  color: var(--color-text-primary);
}

.task-filter-tab.active {
  background: var(--rw-yellow);
  border-color: var(--rw-yellow);
  color: var(--rw-black);
  font-weight: 600;
}

/* Tasks List */
.tasks-list {
  padding: var(--space-md) var(--space-2xl);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

/* Task Card */
.task-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  transition: all var(--transition-base);
  position: relative;
}

.task-card:hover {
  border-color: var(--rw-yellow);
  box-shadow: var(--shadow-md);
}

.task-card.task-card--completed {
  opacity: 0.65;
}

.task-card.task-card--completed .task-card-title {
  text-decoration: line-through;
  color: var(--color-text-muted);
}

.task-card.task-card--overdue {
  border-left: 3px solid var(--color-error);
}

/* Task Checkbox */
.task-checkbox {
  width: 22px;
  height: 22px;
  min-width: 22px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--color-border);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-base);
  background: transparent;
  padding: 0;
  margin-top: 2px;
  flex-shrink: 0;
}

.task-checkbox:hover {
  border-color: var(--rw-yellow);
  background: var(--rw-yellow-subtle);
}

.task-checkbox.checked {
  background: var(--color-success);
  border-color: var(--color-success);
  color: #fff;
}

.task-checkbox.checked svg,
.task-checkbox.checked i {
  width: 14px;
  height: 14px;
  color: #fff;
}

/* Task Card Content */
.task-card-content {
  flex: 1;
  min-width: 0;
}

.task-card-title {
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--color-text-primary);
  line-height: 1.3;
  margin-bottom: 4px;
  cursor: pointer;
}

.task-card-title:hover {
  color: var(--rw-dark-grey);
}

.task-card-description {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--space-sm);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.task-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-sm);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.task-card-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.task-card-meta-item svg,
.task-card-meta-item i {
  width: 13px;
  height: 13px;
}

/* Priority Badge */
.task-priority-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.task-priority-badge--low {
  background: rgba(107, 114, 128, 0.1);
  color: #6b7280;
}

.task-priority-badge--medium {
  background: rgba(59, 130, 246, 0.1);
  color: #3b82f6;
}

.task-priority-badge--high {
  background: rgba(245, 158, 11, 0.1);
  color: #f59e0b;
}

.task-priority-badge--urgent {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

/* Task Category Badge */
.task-category-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 500;
  background: var(--rw-yellow-subtle);
  color: var(--color-text-secondary);
}

/* Task Due Date */
.task-due-date {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.task-due-date--overdue {
  color: var(--color-error) !important;
  font-weight: 600;
}

.task-due-date--today {
  color: var(--color-warning) !important;
  font-weight: 600;
}

/* Task Card Actions */
.task-card-actions {
  display: flex;
  gap: var(--space-xs);
  opacity: 0;
  transition: opacity var(--transition-base);
  flex-shrink: 0;
}

.task-card:hover .task-card-actions {
  opacity: 1;
}

/* Task Linked Items */
.task-linked-item {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--color-text-muted);
  font-size: var(--text-xs);
}

.task-linked-item svg,
.task-linked-item i {
  width: 12px;
  height: 12px;
}

/* Recurring Task Badge */
.task-recurrence-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  background: rgba(139, 92, 246, 0.1);
  color: #8b5cf6;
}

.task-recurrence-badge svg,
.task-recurrence-badge i {
  width: 12px;
  height: 12px;
}

/* Task Form */
.task-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
  max-height: 65vh;
  overflow-y: auto;
  padding-right: 4px;
}

/* Dashboard Tasks Widget */
.dashboard-tasks-list {
  padding: 0 var(--space-2xl) var(--space-md);
}

.dashboard-task-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  background: var(--color-bg-card);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-sm);
  transition: all var(--transition-base);
}

.dashboard-task-item:hover {
  border-color: var(--rw-yellow);
  box-shadow: var(--shadow-sm);
}

.dashboard-task-item.dashboard-task--overdue {
  border-left: 3px solid var(--color-error);
}

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

.dashboard-task-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.dashboard-task-meta svg,
.dashboard-task-meta i {
  width: 12px;
  height: 12px;
}

/* Dark Mode Overrides for Tasks */
[data-theme="dark"] .task-priority-badge--low {
  background: rgba(107, 114, 128, 0.2);
  color: #9ca3af;
}

[data-theme="dark"] .task-priority-badge--medium {
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
}

[data-theme="dark"] .task-priority-badge--high {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
}

[data-theme="dark"] .task-priority-badge--urgent {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
}

[data-theme="dark"] .task-category-badge {
  background: rgba(255, 229, 18, 0.1);
  color: var(--color-text-muted);
}

/* Responsive */
@media (max-width: 768px) {
  .task-filter-tabs {
    padding: var(--space-sm) var(--space-md);
  }

  .tasks-list {
    padding: var(--space-sm) var(--space-md);
  }

  .task-card {
    padding: var(--space-md);
  }

  .task-card-actions {
    opacity: 1;
  }

  .dashboard-tasks-list {
    padding: 0 var(--space-md) var(--space-sm);
  }
}


/* ==============================================================
   NOTIFICATION BELL & DROPDOWN
   ============================================================== */

.notification-bell {
  position: relative;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  margin-left: auto;
  color: var(--color-text-muted);
  transition: color var(--transition-base);
  flex-shrink: 0;
}

.notification-bell:hover {
  color: var(--color-accent);
}

.notification-bell svg,
.notification-bell i {
  width: 20px;
  height: 20px;
}

.notification-badge {
  position: absolute;
  top: 0;
  right: 0;
  background: #ef4444;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  line-height: 1;
  animation: notif-pulse 2s ease-in-out infinite;
}

@keyframes notif-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

.notification-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: var(--space-md);
  right: var(--space-md);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 100;
  max-height: 400px;
  overflow-y: auto;
}

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

.notification-dropdown-header h4 {
  font-size: 14px;
  font-weight: 600;
  margin: 0;
}

.notification-dropdown-body {
  padding: 8px 0;
}

.notification-section-label {
  padding: 8px 16px 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
}

.notification-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 16px;
  cursor: pointer;
  transition: background var(--transition-base);
}

.notification-item:hover {
  background: var(--color-hover);
}

.notification-item--overdue {
  border-left: 3px solid #ef4444;
}

.notification-item-icon {
  flex-shrink: 0;
  color: var(--color-text-muted);
}

.notification-item-icon svg,
.notification-item-icon i {
  width: 16px;
  height: 16px;
}

.notification-item--overdue .notification-item-icon {
  color: #ef4444;
}

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

.notification-item-title {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.notification-item-meta {
  font-size: 11px;
  color: var(--color-text-muted);
  margin-top: 2px;
}

.notification-empty {
  padding: 24px 16px;
  text-align: center;
  color: var(--color-text-muted);
  font-size: 13px;
}

.notification-empty i,
.notification-empty svg {
  display: block;
  width: 28px;
  height: 28px;
  margin: 0 auto 8px;
  color: #22c55e;
}


/* ==============================================================
   CALENDAR VIEW
   ============================================================== */

.tasks-calendar {
  padding: var(--space-md) var(--space-lg);
}

.calendar-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: var(--space-md);
}

.calendar-month-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  min-width: 200px;
  text-align: center;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--color-border);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.calendar-day-header {
  background: var(--color-surface);
  padding: 8px;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
}

.calendar-day {
  background: var(--color-surface);
  min-height: 80px;
  padding: 6px 8px;
  cursor: pointer;
  transition: background var(--transition-base);
  position: relative;
}

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

.calendar-day--empty {
  background: var(--color-bg);
  cursor: default;
}

.calendar-day--today {
  background: rgba(255, 229, 18, 0.06);
}

.calendar-day--today .calendar-day-number {
  background: var(--color-accent);
  color: var(--color-dark);
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.calendar-day--has-overdue {
  background: rgba(239, 68, 68, 0.04);
}

.calendar-day-number {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text);
}

.calendar-day-dots {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-top: 6px;
}

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

.calendar-dot-more {
  font-size: 10px;
  color: var(--color-text-muted);
  line-height: 8px;
}

/* Calendar popup */
.cal-popup-task {
  padding: 10px 12px;
  margin-bottom: 6px;
  background: var(--color-bg);
  border-radius: var(--radius-sm);
}

.cal-popup-task--completed {
  opacity: 0.6;
}

.cal-popup-task--completed .cal-popup-task-title {
  text-decoration: line-through;
}

.cal-popup-task-title {
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 4px;
}

.cal-popup-task-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--color-text-muted);
}

.cal-popup-task-meta i,
.cal-popup-task-meta svg {
  width: 12px;
  height: 12px;
}


/* ==============================================================
   DEAL-TASK LINK BADGE
   ============================================================== */

.task-deal-badge {
  color: #22c55e !important;
}

.task-deal-badge i,
.task-deal-badge svg {
  color: #22c55e;
}


/* ==============================================================
   CONTACT GROUPS
   ============================================================== */

.contact-groups-panel {
  padding: var(--space-md) var(--space-lg);
}

.contact-groups-header {
  display: flex;
  justify-content: flex-end;
  margin-bottom: var(--space-md);
}

.contact-groups-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--space-md);
}

.contact-group-card {
  display: flex;
  align-items: stretch;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: box-shadow var(--transition-base), border-color var(--transition-base);
}

.contact-group-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--color-accent);
}

.contact-group-color {
  width: 6px;
  flex-shrink: 0;
}

.contact-group-info {
  flex: 1;
  padding: 14px 16px;
  min-width: 0;
}

.contact-group-name {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 4px;
}

.contact-group-desc {
  font-size: 12px;
  color: var(--color-text-muted);
  margin: 0 0 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.contact-group-count {
  font-size: 12px;
  color: var(--color-text-muted);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.contact-group-count i,
.contact-group-count svg {
  width: 13px;
  height: 13px;
}

.contact-group-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px;
  gap: 4px;
  opacity: 0;
  transition: opacity var(--transition-base);
}

.contact-group-card:hover .contact-group-actions {
  opacity: 1;
}

/* Color picker in group modal */
.cg-color-picker {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.cg-color-swatch {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s;
}

.cg-color-swatch:hover {
  transform: scale(1.15);
}

.cg-color-swatch.active {
  border-color: var(--color-text);
  transform: scale(1.15);
}

/* Members panel */
.cg-members-panel {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.cg-members-section h4 {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 8px;
}

.cg-members-list,
.cg-add-contacts-list {
  max-height: 250px;
  overflow-y: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
}

.cg-member-item,
.cg-add-contact-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--color-border);
  font-size: 13px;
}

.cg-member-item:last-child,
.cg-add-contact-item:last-child {
  border-bottom: none;
}

.cg-member-item span:first-child,
.cg-add-contact-item span:first-child {
  flex: 1;
  min-width: 0;
}


/* ==============================================================
   DARK MODE - New Features
   ============================================================== */

[data-theme="dark"] .notification-dropdown {
  background: var(--color-surface);
  border-color: var(--color-border);
}

[data-theme="dark"] .calendar-day--today {
  background: rgba(255, 229, 18, 0.08);
}

[data-theme="dark"] .calendar-day--has-overdue {
  background: rgba(239, 68, 68, 0.08);
}

[data-theme="dark"] .cal-popup-task {
  background: var(--color-surface);
}

[data-theme="dark"] .contact-group-card {
  background: var(--color-surface);
}

[data-theme="dark"] .cg-color-swatch.active {
  border-color: #fff;
}

[data-theme="dark"] .notification-item:hover {
  background: rgba(255, 255, 255, 0.05);
}


/* ==============================================================
   RESPONSIVE - New Features
   ============================================================== */

@media (max-width: 768px) {
  .calendar-grid {
    font-size: 11px;
  }

  .calendar-day {
    min-height: 50px;
    padding: 4px;
  }

  .calendar-month-title {
    font-size: 16px;
    min-width: 160px;
  }

  .contact-groups-grid {
    grid-template-columns: 1fr;
  }

  .contact-group-actions {
    opacity: 1;
  }

  .notification-dropdown {
    left: 8px;
    right: 8px;
  }

  .cg-members-panel {
    gap: 12px;
  }
}


/* ==============================================================
   SIDEBAR PROJECT CONTEXT SELECTOR
   ============================================================== */

.sidebar-project-selector {
  padding: 10px 16px;
  border-bottom: 1px solid rgba(255, 229, 18, 0.1);
  margin-bottom: 4px;
}

.project-selector-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}

.project-selector-header .project-selector-icon {
  width: 13px;
  height: 13px;
  color: var(--rw-yellow);
  opacity: 0.7;
}

.project-selector-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.45);
}

.project-selector-controls {
  display: flex;
  gap: 6px;
  align-items: center;
}

.project-context-select {
  flex: 1;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  padding: 6px 8px;
  font-size: 12px;
  color: var(--color-text-on-dark);
  font-family: var(--font-body);
  cursor: pointer;
  appearance: auto;
  transition: border-color var(--transition-fast);
}

.project-context-select:focus {
  outline: none;
  border-color: var(--rw-yellow);
}

.project-context-select option {
  background: #1a1a1a;
  color: #e0e0e0;
}

.project-clear-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  padding: 5px;
  color: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.project-clear-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.3);
}

.project-clear-btn i {
  width: 14px;
  height: 14px;
}

.project-active-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  padding: 4px 8px;
  background: rgba(255, 229, 18, 0.12);
  border: 1px solid rgba(255, 229, 18, 0.25);
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  color: var(--rw-yellow);
}

.project-active-badge i {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}

/* Collapsed sidebar: hide labels */
.sidebar.collapsed .sidebar-project-selector .project-selector-header,
.sidebar.collapsed .sidebar-project-selector .project-active-badge,
.sidebar.collapsed .sidebar-project-selector .project-selector-label {
  display: none;
}

.sidebar.collapsed .sidebar-project-selector {
  padding: 8px;
}

.sidebar.collapsed .project-context-select {
  font-size: 0;
  padding: 6px;
  text-align: center;
}

/* Dashboard project banner */
.dashboard-project-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  margin-bottom: 16px;
  background: rgba(255, 229, 18, 0.08);
  border: 1px solid rgba(255, 229, 18, 0.2);
  border-radius: var(--radius-md);
  font-size: 13px;
  color: var(--color-text-primary);
}

.dashboard-project-banner i {
  width: 16px;
  height: 16px;
  color: var(--rw-yellow);
  flex-shrink: 0;
}

.dashboard-project-banner strong {
  color: var(--rw-yellow);
}

.dashboard-project-banner .project-banner-clear {
  margin-left: auto;
  background: none;
  border: 1px solid rgba(255, 229, 18, 0.3);
  border-radius: var(--radius-sm);
  padding: 3px 8px;
  font-size: 11px;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.dashboard-project-banner .project-banner-clear:hover {
  background: rgba(255, 229, 18, 0.15);
  color: var(--rw-yellow);
}

/* Dark mode adjustments */
[data-theme="dark"] .dashboard-project-banner {
  background: rgba(255, 229, 18, 0.06);
  color: var(--color-text-on-dark);
}

@media (max-width: 768px) {
  .sidebar-project-selector {
    padding: 8px 12px;
  }

  .project-context-select {
    font-size: 11px;
  }
}


/* ==============================================================
   TOOL CHAINING SUGGESTIONS
   ============================================================== */

.tool-chain-suggestions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--color-border-light);
}

.tool-chain-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.tool-chain-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  background: var(--color-bg-secondary);
  font-size: 12px;
  font-family: var(--font-body);
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.tool-chain-chip:hover {
  border-color: var(--rw-yellow);
  background: var(--rw-yellow-subtle);
  color: var(--rw-black);
}

.tool-chain-chip i {
  width: 13px;
  height: 13px;
}

.tool-chain-chip .chain-arrow {
  width: 11px;
  height: 11px;
  opacity: 0.4;
}

.tool-chain-chip:hover .chain-arrow {
  opacity: 1;
  color: var(--rw-yellow);
}


/* ==============================================================
   CHAINED CONTEXT NOTICE
   ============================================================== */

.chained-context-notice {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0;
  padding: 10px 14px;
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: var(--radius-md);
  font-size: 13px;
  color: var(--color-text-secondary);
}

.chained-context-notice i {
  width: 16px;
  height: 16px;
  color: var(--color-info);
  flex-shrink: 0;
}

.chained-dismiss {
  margin-left: auto;
  background: none;
  border: none;
  font-size: 18px;
  color: var(--color-text-muted);
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}

.chained-dismiss:hover {
  color: var(--color-text-primary);
}


/* ==============================================================
   LISTING PACK
   ============================================================== */

.listing-pack-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.listing-pack-btn {
  white-space: nowrap;
  flex-shrink: 0;
}

.listing-pack-progress {
  padding: 8px 0;
}

.listing-pack-intro {
  font-size: 14px;
  color: var(--color-text-secondary);
  margin-bottom: 16px;
}

.listing-pack-items {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.listing-pack-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: var(--color-bg-input-light);
  transition: all var(--transition-fast);
}

.listing-pack-item[data-status="active"] {
  background: rgba(59, 130, 246, 0.08);
  border-left: 3px solid var(--color-info);
}

.listing-pack-item[data-status="done"] {
  background: rgba(34, 197, 94, 0.06);
  border-left: 3px solid var(--color-success);
}

.listing-pack-item[data-status="error"] {
  background: rgba(239, 68, 68, 0.06);
  border-left: 3px solid var(--color-error);
}

.listing-pack-item-icon {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: rgba(0,0,0,0.05);
}

.listing-pack-item-icon i {
  width: 16px;
  height: 16px;
}

.listing-pack-item-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.listing-pack-item-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-primary);
}

.listing-pack-item-status {
  font-size: 11px;
  color: var(--color-text-muted);
}

.listing-pack-item[data-status="active"] .listing-pack-item-status {
  color: var(--color-info);
  font-weight: 600;
}

.listing-pack-item[data-status="done"] .listing-pack-item-status {
  color: var(--color-success);
  font-weight: 600;
}

.listing-pack-item[data-status="error"] .listing-pack-item-status {
  color: var(--color-error);
}

.listing-pack-actions {
  display: flex;
  gap: 8px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--color-border);
  flex-wrap: wrap;
}


/* ==============================================================
   RECENT OUTPUTS (Dashboard)
   ============================================================== */

.recent-outputs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

.recent-output-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 14px;
  transition: all var(--transition-fast);
  cursor: default;
}

.recent-output-card:hover {
  border-color: var(--rw-yellow);
  box-shadow: var(--shadow-sm);
}

.recent-output-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.recent-output-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--rw-yellow-subtle);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.recent-output-icon i {
  width: 16px;
  height: 16px;
  color: var(--rw-yellow-hover);
}

.recent-output-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.recent-output-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recent-output-tool {
  font-size: 11px;
  color: var(--color-text-muted);
}

.recent-output-preview {
  font-size: 12px;
  color: var(--color-text-secondary);
  line-height: 1.5;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.recent-output-actions {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
}


/* ==============================================================
   USE IN TOOL PICKER
   ============================================================== */

.use-in-tool-picker {
  padding: 4px 0;
}

.use-in-tool-preview {
  background: var(--color-bg-input-light);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 14px;
  font-size: 12px;
}

.use-in-tool-preview strong {
  display: block;
  margin-bottom: 4px;
}

.use-in-tool-preview p {
  color: var(--color-text-muted);
  margin: 0;
}

.use-in-tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 6px;
  max-height: 320px;
  overflow-y: auto;
}

.use-in-tool-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg-secondary);
  font-size: 12px;
  font-family: var(--font-body);
  color: var(--color-text-primary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.use-in-tool-option:hover {
  border-color: var(--rw-yellow);
  background: var(--rw-yellow-subtle);
}

.use-in-tool-option i {
  width: 16px;
  height: 16px;
  color: var(--color-text-muted);
  flex-shrink: 0;
}

.use-in-tool-option:hover i {
  color: var(--rw-yellow);
}


/* ==============================================================
   SAVE & EMAIL BUTTONS (action-btn)
   ============================================================== */

.action-btn.save-btn:hover {
  color: var(--rw-yellow);
}

.action-btn.email-btn {
  color: var(--color-info);
}

.action-btn.email-btn:hover {
  color: #2563eb;
}
