/* DesignDesk — Production App Styles
   ====================================
   Table of Contents:
   1.  Design Tokens & Custom Properties
   2.  Reset & Base Typography
   3.  Keyframe Animations
   4.  Layout Shell
   5.  Sidebar Navigation
   6.  Topbar
   7.  Buttons
   8.  Forms & Validation
   9.  Custom Controls (Checkbox, Toggle, Range, Select)
   10. Tables
   11. Status Badges & Tags
   12. Modals
   13. Toasts
   14. Skeleton Loading
   15. Empty States & Errors
   16. Dashboard
   17. Procurement
   18. Schedule (Gantt)
   19. Invoicing
   20. Suppliers
   21. Mood Board
   22. Floor Plan
   23. Client Portal
   24. AI Chat Assistant
   25. Presentations
   26. Settings & Notifications
   27. Scrollbar Styling
   28. Focus Management & Accessibility
   29. Print Styles
   30. Responsive: 1200px
   31. Responsive: 768px (Tablet)
   32. Responsive: 480px (Mobile)
   33. Fullscreen
   ==================================== */


/* ==========================================================================
   1. DESIGN TOKENS & CUSTOM PROPERTIES
   ========================================================================== */

:root {
  /* Primary palette */
  --primary: #6366f1;
  --primary-light: #818cf8;
  --primary-dark: #4f46e5;
  --primary-50: rgba(99, 102, 241, 0.05);
  --primary-100: rgba(99, 102, 241, 0.10);
  --primary-200: rgba(99, 102, 241, 0.20);
  --primary-300: rgba(99, 102, 241, 0.30);

  /* Accent */
  --accent: #a855f7;
  --accent-light: #c084fc;
  --accent-50: rgba(168, 85, 247, 0.05);

  /* Surfaces */
  --bg: #f8fafc;
  --bg-elevated: #ffffff;
  --surface: #ffffff;
  --surface-hover: #fafafb;
  --surface-pressed: #f5f5f7;

  /* Text hierarchy */
  --text: #1e293b;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --text-disabled: #cbd5e1;
  --text-inverse: #ffffff;

  /* Borders */
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --border-strong: #cbd5e1;
  --border-focus: var(--primary);

  /* Status colors — base */
  --success: #10b981;
  --success-light: #d1fae5;
  --success-dark: #059669;
  --warning: #f59e0b;
  --warning-light: #fef3c7;
  --warning-dark: #d97706;
  --error: #ef4444;
  --error-light: #fee2e2;
  --error-dark: #dc2626;
  --info: #3b82f6;
  --info-light: #dbeafe;
  --info-dark: #2563eb;

  /* Status badge colors */
  --status-spec-bg: #f1f5f9;
  --status-spec-text: #64748b;
  --status-quoted-bg: #eef2ff;
  --status-quoted-text: #6366f1;
  --status-ordered-bg: #fef3c7;
  --status-ordered-text: #d97706;
  --status-shipped-bg: #dbeafe;
  --status-shipped-text: #2563eb;
  --status-delivered-bg: #d1fae5;
  --status-delivered-text: #059669;
  --status-installed-bg: #ede9fe;
  --status-installed-text: #7c3aed;
  --status-draft-bg: #f1f5f9;
  --status-draft-text: #64748b;
  --status-sent-bg: #dbeafe;
  --status-sent-text: #2563eb;
  --status-paid-bg: #d1fae5;
  --status-paid-text: #059669;
  --status-overdue-bg: #fee2e2;
  --status-overdue-text: #dc2626;
  --status-active-bg: #d1fae5;
  --status-active-text: #059669;
  --status-planning-bg: #dbeafe;
  --status-planning-text: #2563eb;
  --status-completed-bg: #f1f5f9;
  --status-completed-text: #64748b;

  /* Radii */
  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Shadows — hierarchy */
  --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: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.07), 0 2px 4px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.08);
  --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.12);

  /* Layout dimensions */
  --sidebar-w: 240px;
  --topbar-h: 56px;

  /* Typography scale */
  --text-xs: 11px;
  --text-sm: 12px;
  --text-base: 13px;
  --text-md: 14px;
  --text-lg: 16px;
  --text-xl: 22px;
  --text-2xl: 28px;

  /* Transitions */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.45, 0, 0.55, 1);
  --duration-fast: 0.15s;
  --duration-normal: 0.2s;
  --duration-slow: 0.3s;

  /* Z-index scale */
  --z-base: 1;
  --z-dropdown: 10;
  --z-sticky: 20;
  --z-topbar: 50;
  --z-sidebar: 100;
  --z-overlay: 500;
  --z-modal: 1000;
  --z-toast: 2000;

  /* Dark mode tokens (defined but not toggled — ready for future use) */
  --dm-bg: #0f172a;
  --dm-surface: #1e293b;
  --dm-surface-hover: #273548;
  --dm-text: #f1f5f9;
  --dm-text-secondary: #94a3b8;
  --dm-text-muted: #64748b;
  --dm-border: #334155;
  --dm-border-light: #1e293b;

  /* Client portal accent (gold) */
  --client-accent: #d4a853;
  --client-accent-hover: #c49a42;
  --client-bg: #111827;
  --client-surface: #1e293b;
}


/* ==========================================================================
   2. RESET & BASE TYPOGRAPHY
   ========================================================================== */

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

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

h1 { font-size: var(--text-xl); font-weight: 700; line-height: 1.3; letter-spacing: -0.01em; }
h2 { font-size: 18px; font-weight: 600; line-height: 1.35; }
h3 { font-size: var(--text-lg); font-weight: 600; line-height: 1.4; }
h4 { font-size: var(--text-md); font-weight: 600; line-height: 1.4; }

p { font-size: var(--text-base); }

a { color: var(--primary); text-decoration: none; transition: color var(--duration-fast) ease; }
a:hover { color: var(--primary-dark); }

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

/* Skip to content link for accessibility */
.skip-to-content {
  position: absolute;
  top: -100%;
  left: 16px;
  z-index: calc(var(--z-toast) + 1);
  padding: 8px 16px;
  background: var(--primary);
  color: var(--text-inverse);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: 600;
  transition: top var(--duration-fast) ease;
}
.skip-to-content:focus {
  top: 16px;
  color: var(--text-inverse);
}


/* ==========================================================================
   3. KEYFRAME ANIMATIONS
   ========================================================================== */

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

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

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

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

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

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

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

@keyframes typing {
  0%, 60%, 100% { opacity: 0.3; transform: scale(0.85); }
  30% { opacity: 1; transform: scale(1); }
}

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

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

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

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes dotPulse {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}


/* ==========================================================================
   4. LAYOUT SHELL
   ========================================================================== */

.app-layout {
  display: flex;
  min-height: 100vh;
}

.app-sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: var(--z-sidebar);
  overflow-y: auto;
  overflow-x: hidden;
  transition: transform var(--duration-normal) var(--ease-out);
}

.app-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left var(--duration-normal) var(--ease-out);
}

.app-topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: var(--z-topbar);
  backdrop-filter: blur(8px);
  background: rgba(255, 255, 255, 0.92);
}

.app-main {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
}

/* Page view fade-in on route change */
.app-main > * {
  animation: fadeInUp var(--duration-slow) var(--ease-out) both;
}

/* Sidebar mobile overlay backdrop */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(2px);
  z-index: calc(var(--z-sidebar) - 1);
  animation: backdropIn var(--duration-normal) ease both;
}
.sidebar-backdrop.show {
  display: block;
}


/* ==========================================================================
   5. SIDEBAR NAVIGATION
   ========================================================================== */

.sidebar-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: var(--text-lg);
}

.sidebar-project-selector {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
}

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

.sidebar-project-selector select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: var(--text-base);
  font-family: inherit;
  color: var(--text);
  background: var(--bg);
  cursor: pointer;
  transition: border-color var(--duration-fast) ease;
}
.sidebar-project-selector select:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 3px var(--primary-200);
}

.sidebar-nav {
  padding: 8px;
  flex: 1;
}

.sidebar-nav-section {
  margin-top: 8px;
}

.sidebar-nav-section-title {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 8px 12px 4px;
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: var(--text-base);
  font-weight: 500;
  transition: all var(--duration-normal) var(--ease-out);
  cursor: pointer;
  position: relative;
  user-select: none;
}

.sidebar-nav-item:hover {
  background: var(--border-light);
  color: var(--text);
  transform: translateX(2px);
}

.sidebar-nav-item.active {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(168, 85, 247, 0.06));
  color: var(--primary);
}

.sidebar-nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--primary);
}

.sidebar-nav-item:active {
  transform: scale(0.98);
}

.sidebar-icon {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.sidebar-icon svg { width: 18px; height: 18px; }

.sidebar-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: var(--text-inverse);
  margin-left: auto;
  min-width: 18px;
  text-align: center;
}

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border-light);
}

.sidebar-back {
  font-size: var(--text-sm);
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--duration-fast) ease;
}
.sidebar-back:hover { color: var(--primary); }


/* ==========================================================================
   6. TOPBAR
   ========================================================================== */

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-menu-btn {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 4px;
  border-radius: var(--radius-xs);
  transition: color var(--duration-fast) ease, background var(--duration-fast) ease;
}
.topbar-menu-btn:hover {
  color: var(--text);
  background: var(--border-light);
}

.topbar-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--text-md);
}

.topbar-project { color: var(--text-muted); }
.topbar-sep { color: var(--border); }
.topbar-title { font-weight: 600; }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

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

.topbar-search-icon {
  position: absolute;
  left: 10px;
  color: var(--text-muted);
  display: flex;
  pointer-events: none;
}
.topbar-search-icon svg { width: 16px; height: 16px; }

.topbar-search input {
  padding: 7px 10px 7px 34px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: var(--text-base);
  font-family: inherit;
  width: 200px;
  background: var(--bg);
  transition: border-color var(--duration-fast) ease, box-shadow var(--duration-fast) ease, width var(--duration-normal) ease;
}
.topbar-search input:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 3px var(--primary-200);
  width: 260px;
}

.topbar-notif {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  position: relative;
  display: flex;
  align-items: center;
  padding: 4px;
  border-radius: var(--radius-xs);
  transition: color var(--duration-fast) ease, background var(--duration-fast) ease;
}
.topbar-notif:hover {
  color: var(--text);
  background: var(--border-light);
}
.topbar-notif svg { width: 20px; height: 20px; }

.notif-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  background: var(--error);
  color: var(--text-inverse);
  font-size: 10px;
  font-weight: 700;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--surface);
  animation: scaleIn var(--duration-fast) var(--ease-out) both;
}

.topbar-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: var(--text-inverse);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
  font-weight: 700;
  cursor: pointer;
  transition: transform var(--duration-fast) ease, box-shadow var(--duration-fast) ease;
}
.topbar-avatar:hover {
  transform: scale(1.05);
  box-shadow: 0 0 0 3px var(--primary-200);
}


/* ==========================================================================
   7. BUTTONS
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: var(--text-base);
  text-decoration: none;
  transition: all var(--duration-fast) var(--ease-out);
  cursor: pointer;
  border: none;
  font-family: inherit;
  white-space: nowrap;
  user-select: none;
  position: relative;
  overflow: hidden;
}

.btn:active {
  transform: scale(0.97);
}

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

.btn-sm { padding: 7px 14px; font-size: var(--text-sm); }
.btn-lg { padding: 12px 24px; font-size: var(--text-md); }
.btn-xs { padding: 4px 10px; font-size: var(--text-xs); }
.btn svg { width: 16px; height: 16px; }

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: var(--text-inverse);
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.25);
}
.btn-primary:hover {
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
  transform: translateY(-1px);
}
.btn-primary:active {
  transform: translateY(0) scale(0.97);
  box-shadow: 0 1px 4px rgba(99, 102, 241, 0.20);
}

.btn-secondary {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  background: var(--border-light);
  border-color: var(--border-strong);
}

.btn-outline {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-50);
}

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

.btn-danger {
  background: var(--error);
  color: var(--text-inverse);
}
.btn-danger:hover {
  background: var(--error-dark);
}

.icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px;
  border-radius: var(--radius-xs);
  display: inline-flex;
  align-items: center;
  transition: all var(--duration-fast) ease;
}
.icon-btn:hover {
  color: var(--primary);
  background: var(--border-light);
}
.icon-btn:active { transform: scale(0.92); }
.icon-btn svg { width: 16px; height: 16px; }


/* ==========================================================================
   8. FORMS & VALIDATION
   ========================================================================== */

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.form-group.full { grid-column: 1 / -1; }

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

.form-group input,
.form-group select,
.form-group textarea {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: var(--text-base);
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  transition: border-color var(--duration-fast) ease, box-shadow var(--duration-fast) ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 3px var(--primary-200);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--text-muted);
}

.form-group textarea { resize: vertical; min-height: 80px; }

/* Validation states */
.form-group.has-error input,
.form-group.has-error select,
.form-group.has-error textarea {
  border-color: var(--error);
}
.form-group.has-error input:focus,
.form-group.has-error select:focus,
.form-group.has-error textarea:focus {
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2);
}

.form-error {
  font-size: var(--text-xs);
  color: var(--error);
  display: flex;
  align-items: center;
  gap: 4px;
  animation: fadeIn var(--duration-fast) ease;
}
.form-error::before {
  content: '';
  width: 12px;
  height: 12px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%23ef4444'%3E%3Cpath fill-rule='evenodd' d='M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z' clip-rule='evenodd'/%3E%3C/svg%3E") no-repeat center / contain;
  flex-shrink: 0;
}

.form-group.has-success input,
.form-group.has-success select,
.form-group.has-success textarea {
  border-color: var(--success);
}
.form-group.has-success input:focus,
.form-group.has-success select:focus {
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

.form-success-icon {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--success);
  width: 16px;
  height: 16px;
}

/* Disabled state */
.form-group input:disabled,
.form-group select:disabled,
.form-group textarea:disabled {
  background: var(--border-light);
  color: var(--text-disabled);
  cursor: not-allowed;
  border-color: var(--border-light);
}

.calc-price {
  padding: 8px 10px;
  background: var(--border-light);
  border-radius: 6px;
  font-weight: 700;
  font-size: var(--text-md);
  color: var(--primary);
}


/* ==========================================================================
   9. CUSTOM CONTROLS (Checkbox, Toggle, Range, Select)
   ========================================================================== */

/* Custom checkbox */
.checkbox-list { max-height: 200px; overflow-y: auto; }

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  font-size: var(--text-base);
  cursor: pointer;
  transition: color var(--duration-fast) ease;
}
.checkbox-item:hover { color: var(--text); }

.checkbox-item input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border: 2px solid var(--border-strong);
  border-radius: var(--radius-xs);
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  transition: all var(--duration-fast) ease;
}

.checkbox-item input[type="checkbox"]:checked {
  background: var(--primary);
  border-color: var(--primary);
}

.checkbox-item input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 4px;
  top: 1px;
  width: 6px;
  height: 10px;
  border: 2px solid white;
  border-top: 0;
  border-left: 0;
  transform: rotate(45deg);
}

.checkbox-item input[type="checkbox"]:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--primary-200);
}

/* Toggle switch */
.toggle-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  gap: 8px;
}

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

.toggle-track {
  width: 36px;
  height: 20px;
  background: var(--border-strong);
  border-radius: var(--radius-full);
  position: relative;
  transition: background var(--duration-normal) ease;
  flex-shrink: 0;
}

.toggle-track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: white;
  box-shadow: var(--shadow-xs);
  transition: transform var(--duration-normal) var(--ease-out);
}

.toggle-switch input:checked + .toggle-track {
  background: var(--primary);
}
.toggle-switch input:checked + .toggle-track::after {
  transform: translateX(16px);
}
.toggle-switch input:focus-visible + .toggle-track {
  box-shadow: 0 0 0 3px var(--primary-200);
}

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

/* Custom range slider */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: var(--border);
  outline: none;
  transition: background var(--duration-fast) ease;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(99, 102, 241, 0.3);
  transition: transform var(--duration-fast) ease, box-shadow var(--duration-fast) ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4);
}

input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  border: none;
  box-shadow: 0 1px 4px rgba(99, 102, 241, 0.3);
}

/* Custom select dropdown arrow */
.custom-select {
  position: relative;
}
.custom-select select {
  -webkit-appearance: none;
  appearance: none;
  padding-right: 32px !important;
}
.custom-select::after {
  content: '';
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 5px solid var(--text-muted);
  pointer-events: none;
}


/* ==========================================================================
   10. TABLES
   ========================================================================== */

.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
}

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

.data-table thead th {
  text-align: left;
  padding: 10px 12px;
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: var(--z-base);
}

.data-table tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.data-table tbody tr {
  transition: background var(--duration-fast) ease;
}

.data-table tbody tr:nth-child(even) {
  background: var(--primary-50);
}

.data-table tbody tr:hover {
  background: var(--primary-100);
}

.sortable {
  cursor: pointer;
  user-select: none;
  transition: color var(--duration-fast) ease;
  position: relative;
  padding-right: 20px !important;
}
.sortable:hover { color: var(--primary); }

.sortable::after {
  content: '\25B2\25BC';
  position: absolute;
  right: 4px;
  font-size: 8px;
  line-height: 1;
  letter-spacing: -1px;
  opacity: 0.3;
  writing-mode: vertical-lr;
  color: var(--text-muted);
}

.sortable.sort-asc::after {
  content: '\25B2';
  opacity: 1;
  color: var(--primary);
  writing-mode: horizontal-tb;
  font-size: 10px;
}
.sortable.sort-desc::after {
  content: '\25BC';
  opacity: 1;
  color: var(--primary);
  writing-mode: horizontal-tb;
  font-size: 10px;
}

/* Resizable column headers */
.data-table thead th.resizable {
  border-right: 2px solid transparent;
}
.data-table thead th.resizable:hover {
  border-right-color: var(--border);
  cursor: col-resize;
}

.clickable-row { cursor: pointer; }
.clickable-row:hover { background: var(--primary-100) !important; }

.row-actions { display: flex; gap: 4px; }

.empty-cell {
  text-align: center;
  color: var(--text-muted);
  padding: 32px !important;
  font-style: italic;
}

.text-right { text-align: right; }
.text-center { text-align: center; }
.text-success { color: var(--success); }
.text-error { color: var(--error); }
.text-warning { color: var(--warning); }
.text-muted { color: var(--text-muted); }


/* ==========================================================================
   11. STATUS BADGES & TAGS
   ========================================================================== */

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: capitalize;
  white-space: nowrap;
  transition: opacity var(--duration-fast) ease;
}

.status-spec { background: var(--status-spec-bg); color: var(--status-spec-text); }
.status-quoted { background: var(--status-quoted-bg); color: var(--status-quoted-text); }
.status-ordered { background: var(--status-ordered-bg); color: var(--status-ordered-text); }
.status-shipped { background: var(--status-shipped-bg); color: var(--status-shipped-text); }
.status-delivered { background: var(--status-delivered-bg); color: var(--status-delivered-text); }
.status-installed { background: var(--status-installed-bg); color: var(--status-installed-text); }
.status-draft { background: var(--status-draft-bg); color: var(--status-draft-text); }
.status-sent { background: var(--status-sent-bg); color: var(--status-sent-text); }
.status-paid { background: var(--status-paid-bg); color: var(--status-paid-text); }
.status-overdue { background: var(--status-overdue-bg); color: var(--status-overdue-text); }
.status-active { background: var(--status-active-bg); color: var(--status-active-text); }
.status-planning { background: var(--status-planning-bg); color: var(--status-planning-text); }
.status-completed { background: var(--status-completed-bg); color: var(--status-completed-text); }

.project-status-badge {
  padding: 4px 14px;
  border-radius: var(--radius-xl);
  font-size: var(--text-sm);
  font-weight: 600;
}

/* Dot indicator */
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.status-dot.online { background: var(--success); }
.status-dot.offline { background: var(--text-muted); }
.status-dot.busy { background: var(--warning); }

/* Pill badge with count */
.pill-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: 700;
  background: var(--primary);
  color: var(--text-inverse);
}
.pill-badge.warning { background: var(--warning); }
.pill-badge.error { background: var(--error); }
.pill-badge.success { background: var(--success); }

.room-badge {
  background: var(--border-light);
  padding: 2px 8px;
  border-radius: var(--radius-xs);
  font-size: var(--text-xs);
}

/* Tag input style */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  background: var(--border-light);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--duration-fast) ease;
}
.tag:hover { background: var(--border); }

.tag-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 10px;
  color: var(--text-muted);
  transition: all var(--duration-fast) ease;
}
.tag-remove:hover {
  background: var(--error-light);
  color: var(--error);
}

.tag-input-wrapper {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  min-height: 36px;
  align-items: center;
  transition: border-color var(--duration-fast) ease, box-shadow var(--duration-fast) ease;
}
.tag-input-wrapper:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-200);
}
.tag-input-wrapper input {
  border: none;
  outline: none;
  font-size: var(--text-base);
  font-family: inherit;
  flex: 1;
  min-width: 80px;
  padding: 2px 0;
}


/* ==========================================================================
   12. MODALS
   ========================================================================== */

.modal-container {
  display: none;
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
}
.modal-container.open {
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  animation: backdropIn var(--duration-normal) ease both;
}

.modal {
  position: relative;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xl);
  width: 90%;
  max-width: 520px;
  max-height: 80vh;
  overflow-y: auto;
  animation: slideUp var(--duration-slow) var(--ease-out) both;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
}
.modal-header h3 { font-size: var(--text-lg); }

.modal-close {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--text-muted);
  line-height: 1;
  padding: 4px;
  border-radius: var(--radius-xs);
  transition: all var(--duration-fast) ease;
}
.modal-close:hover {
  color: var(--text);
  background: var(--border-light);
}

.modal-body { padding: 20px; }

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid var(--border-light);
}


/* ==========================================================================
   13. TOASTS
   ========================================================================== */

.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--surface);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  font-size: var(--text-base);
  font-weight: 500;
  animation: slideInRight var(--duration-slow) var(--ease-out) both;
  pointer-events: auto;
  border-left: 3px solid var(--primary);
}

.toast.hiding {
  animation: slideOutRight var(--duration-slow) var(--ease-out) both;
}

.toast.show {
  transform: translateX(0);
  opacity: 1;
}

.toast-success { border-left-color: var(--success); }
.toast-success .toast-icon { color: var(--success); }
.toast-error { border-left-color: var(--error); }
.toast-error .toast-icon { color: var(--error); }
.toast-warning { border-left-color: var(--warning); }
.toast-warning .toast-icon { color: var(--warning); }
.toast-info { border-left-color: var(--primary); }
.toast-info .toast-icon { color: var(--primary); }


/* ==========================================================================
   14. SKELETON LOADING
   ========================================================================== */

.skeleton {
  background: linear-gradient(90deg, var(--border-light) 25%, var(--border) 50%, var(--border-light) 75%);
  background-size: 800px 100%;
  animation: shimmer 1.5s infinite linear;
  border-radius: var(--radius-sm);
  color: transparent !important;
  pointer-events: none;
  user-select: none;
}

.skeleton * { visibility: hidden; }

.skeleton-text {
  height: 14px;
  border-radius: var(--radius-xs);
  margin-bottom: 8px;
}
.skeleton-text.short { width: 40%; }
.skeleton-text.medium { width: 65%; }
.skeleton-text.long { width: 90%; }

.skeleton-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
}

.skeleton-card {
  height: 100px;
  border-radius: var(--radius);
}

.skeleton-stat {
  height: 90px;
  border-radius: var(--radius);
}

.skeleton-table-row {
  height: 44px;
  border-radius: var(--radius-xs);
  margin-bottom: 4px;
}

.skeleton-chart {
  height: 200px;
  border-radius: var(--radius);
}

/* Initial loading state shown before JS loads */
.initial-loading {
  display: flex;
  min-height: 100vh;
}
.initial-loading .skeleton-sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 16px;
  flex-shrink: 0;
}
.initial-loading .skeleton-content {
  flex: 1;
  padding: 24px;
}
.initial-loading .skeleton-topbar {
  height: var(--topbar-h);
  border-bottom: 1px solid var(--border);
  margin: -24px -24px 24px;
  padding: 0 24px;
}
.initial-loading .skeleton-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.initial-loading .skeleton-panels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}


/* ==========================================================================
   15. EMPTY STATES & ERRORS
   ========================================================================== */

.view-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
}

.loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

.empty-state {
  text-align: center;
  padding: 60px 40px;
  color: var(--text-secondary);
  max-width: 400px;
  margin: 0 auto;
}

.empty-state-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: var(--border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}
.empty-state-icon svg { width: 36px; height: 36px; }

.empty-state h2,
.empty-state h3 {
  margin-bottom: 8px;
  color: var(--text);
}

.empty-state p {
  font-size: var(--text-md);
  margin-bottom: 20px;
  line-height: 1.6;
}

.empty-state .btn {
  margin-top: 4px;
}

.view-error {
  text-align: center;
  padding: 60px 40px;
  color: var(--error);
}
.view-error p { margin-top: 8px; color: var(--text-secondary); }

.hidden { display: none !important; }


/* ==========================================================================
   16. DASHBOARD
   ========================================================================== */

.view-dashboard h1 { font-size: var(--text-xl); }

.dash-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  transition: all var(--duration-normal) var(--ease-out);
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}

.stat-label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
  margin-top: 4px;
}

.stat-value.hero {
  font-size: var(--text-2xl);
}

.stat-sub {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-top: 4px;
}

.stat-progress {
  width: 100%;
  height: 6px;
  background: var(--border-light);
  border-radius: 3px;
  margin-top: 8px;
  overflow: hidden;
}

.stat-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 3px;
  transition: width 0.6s var(--ease-out);
}

.dash-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.dash-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  flex-direction: column;
  transition: box-shadow var(--duration-normal) ease;
}

.dash-panel:hover {
  box-shadow: var(--shadow-sm);
}

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

/* Phase legend */
.phase-legend { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.phase-tag { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: 11px; font-weight: 600; letter-spacing: 0.02em; }

/* Donut chart */
.donut-container { display: flex; align-items: center; gap: 20px; }
.donut-chart { width: 100px; height: 100px; flex-shrink: 0; }
.donut-legend { display: flex; flex-direction: column; gap: 4px; }
.legend-item { display: flex; align-items: center; gap: 6px; font-size: var(--text-sm); color: var(--text-secondary); }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.status-dot-spec { background: #94a3b8; }
.status-dot-quoted { background: #6366f1; }
.status-dot-ordered { background: #f59e0b; }
.status-dot-shipped { background: #3b82f6; }
.status-dot-delivered { background: #10b981; }
.status-dot-installed { background: #8b5cf6; }

/* Activity feed */
.activity-feed { display: flex; flex-direction: column; gap: 0; }

.activity-item {
  display: flex;
  gap: 12px;
  padding: 8px 0;
  position: relative;
}

.activity-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  margin-top: 6px;
  flex-shrink: 0;
}

.activity-item::before {
  content: '';
  position: absolute;
  left: 3.5px;
  top: 20px;
  bottom: -4px;
  width: 1px;
  background: var(--border-light);
}
.activity-item:last-child::before { display: none; }

.activity-content { font-size: var(--text-base); }
.activity-content strong { display: block; margin-bottom: 1px; }
.activity-content p { color: var(--text-secondary); margin-bottom: 2px; }

/* Upcoming tasks */
.upcoming-task {
  padding: 8px 0;
  border-bottom: 1px solid var(--border-light);
  transition: background var(--duration-fast) ease;
}
.upcoming-task:last-child { border: none; }
.upcoming-task:hover { background: var(--primary-50); margin: 0 -8px; padding-left: 8px; padding-right: 8px; border-radius: var(--radius-sm); }

.upcoming-task-name { font-size: var(--text-base); font-weight: 600; }
.upcoming-task-contractor { font-size: var(--text-xs); margin-top: 2px; }
.upcoming-task-progress { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.upcoming-task-progress span { font-size: var(--text-xs); font-weight: 600; color: var(--text-secondary); }

.mini-progress { flex: 1; height: 4px; background: var(--border-light); border-radius: 2px; overflow: hidden; }
.mini-progress-bar { height: 100%; border-radius: 2px; background: var(--primary); transition: width 0.5s var(--ease-out); }
.phase-structural { background: #ef4444; }
.phase-firstfix { background: #f59e0b; }
.phase-finishing { background: #3b82f6; }
.phase-install { background: #10b981; }

/* Quick links */
.quick-links { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.quick-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--duration-normal) var(--ease-out);
  text-decoration: none;
}
.quick-link:hover {
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-1px);
  box-shadow: var(--shadow-xs);
}
.quick-link:active { transform: scale(0.97); }
.quick-link svg { width: 18px; height: 18px; }


/* ==========================================================================
   17. PROCUREMENT
   ========================================================================== */

.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.view-header h1 { font-size: var(--text-xl); }
.header-actions { display: flex; gap: 8px; align-items: center; }
.required { color: var(--error); }
.checkbox-label { display: flex; align-items: center; gap: 8px; font-size: var(--text-sm); cursor: pointer; }
.text-muted { color: var(--text-muted); }

.pipeline-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
  overflow-x: auto;
}

.pipeline-stage { display: flex; align-items: center; gap: 6px; }
.pipeline-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.pipeline-label { font-size: var(--text-sm); font-weight: 500; color: var(--text-secondary); text-transform: capitalize; }
.pipeline-count { font-size: var(--text-sm); font-weight: 700; color: var(--text); }
.pipeline-arrow { color: var(--text-muted); font-size: var(--text-md); margin: 0 4px; }

.summary-bar {
  display: flex;
  gap: 24px;
  padding: 12px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
}
.summary-item { display: flex; flex-direction: column; gap: 2px; }
.summary-item span { font-size: var(--text-xs); }
.summary-item strong { font-size: 15px; }

.table-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.filter-group { display: flex; gap: 8px; }

.filter-select {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: var(--text-sm);
  font-family: inherit;
  background: var(--surface);
  transition: border-color var(--duration-fast) ease;
}
.filter-select:focus {
  border-color: var(--primary);
  outline: none;
}

.item-name { font-weight: 600; }


/* ==========================================================================
   18. SCHEDULE (GANTT) — Production
   ========================================================================== */

.view-schedule { position: relative; }
.schedule-project-info { font-size: var(--text-sm); color: var(--text-muted); margin-top: 2px; }

/* Progress bar */
.schedule-progress-bar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 16px;
}
.schedule-progress-label { display: flex; justify-content: space-between; font-size: var(--text-sm); margin-bottom: 6px; }
.schedule-progress-pct { font-weight: 700; }
.schedule-progress-track { height: 8px; background: var(--border-light); border-radius: 4px; overflow: hidden; }
.schedule-progress-fill { height: 100%; border-radius: 4px; transition: width 0.5s ease; }
.schedule-behind-warning { margin-top: 8px; font-size: var(--text-xs); color: var(--error); display: flex; align-items: center; gap: 6px; font-weight: 600; }
.schedule-behind-warning svg { width: 14px; height: 14px; }

/* Toolbar */
.schedule-toolbar {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding: 10px 0;
}
.schedule-view-tabs { display: flex; gap: 0; }
.schedule-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: var(--text-sm);
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.15s ease;
}
.schedule-tab:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.schedule-tab:last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; border-left: none; }
.schedule-tab:not(:first-child):not(:last-child) { border-left: none; }
.schedule-tab:hover { background: var(--border-light); }
.schedule-tab.active { background: var(--primary); color: white; border-color: var(--primary); }
.schedule-tab svg { width: 16px; height: 16px; }

/* Zoom controls */
.schedule-zoom-controls { display: flex; align-items: center; gap: 6px; }
.zoom-label { font-size: var(--text-xs); color: var(--text-muted); font-weight: 600; }
.zoom-btn {
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: var(--text-xs);
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  background: var(--surface);
  color: var(--text-secondary);
  transition: all 0.15s ease;
}
.zoom-btn:hover { border-color: var(--primary); color: var(--primary); }
.zoom-btn.active { background: var(--primary); color: white; border-color: var(--primary); }

/* Legend */
.schedule-gantt-legend { display: flex; gap: 14px; margin-left: auto; }
.gantt-legend-item { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--text-secondary); }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

/* Bulk actions */
.schedule-bulk-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--primary-50);
  border: 1px solid var(--primary-200);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--primary);
}

/* ── Gantt chart ─────────────────────────────────────────────────────── */
.gantt-container {
  display: flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.gantt-labels {
  flex-shrink: 0;
  border-right: 2px solid var(--border);
  position: sticky;
  left: 0;
  z-index: 10;
  background: var(--surface);
  overflow-y: hidden;
}

.gantt-label-header {
  display: flex;
  align-items: center;
  padding: 0 14px;
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.gantt-label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  border-bottom: 1px solid var(--border-light);
  transition: background 0.12s ease;
  cursor: default;
}
.gantt-label:hover { background: var(--primary-50); }
.gantt-label.selected { background: var(--primary-100); }

.gantt-select-cb {
  width: 14px;
  height: 14px;
  cursor: pointer;
  flex-shrink: 0;
  accent-color: var(--primary);
}

.gantt-task-name { font-size: var(--text-sm); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gantt-task-contractor { font-size: 10px; color: var(--text-muted); }

.gantt-scroll { overflow-x: auto; flex: 1; }
.gantt-svg { display: block; }

.gantt-bar { cursor: grab; transition: opacity 0.12s ease; }
.gantt-bar:hover { opacity: 0.9; }
.gantt-bar:active { cursor: grabbing; }
.gantt-bar.selected rect.gantt-bar-outline { stroke-width: 2.5; }
.gantt-bar-text { pointer-events: none; user-select: none; }

/* Gantt tooltip — enhanced */
.gantt-tooltip {
  position: fixed;
  background: var(--text);
  color: #fff;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  pointer-events: none;
  z-index: 9999;
  max-width: 300px;
  box-shadow: 0 8px 24px rgba(0,0,0,.2);
  line-height: 1.6;
}
.gantt-tooltip-title { font-weight: 700; font-size: 13px; margin-bottom: 4px; border-bottom: 1px solid rgba(255,255,255,.15); padding-bottom: 4px; }
.gantt-tooltip-row { display: flex; gap: 6px; }
.gantt-tooltip-row span:first-child { color: rgba(255,255,255,.6); min-width: 80px; }
.gantt-tooltip-notes { margin-top: 6px; padding-top: 6px; border-top: 1px solid rgba(255,255,255,.15); font-style: italic; color: rgba(255,255,255,.7); }

/* Context menu */
.gantt-context-menu {
  position: absolute;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  z-index: 9999;
  min-width: 180px;
  padding: 4px 0;
  font-size: var(--text-sm);
}
.gantt-context-menu.hidden { display: none; }
.ctx-item {
  padding: 8px 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  transition: background 0.1s ease;
}
.ctx-item:hover { background: var(--primary-50); color: var(--primary); }
.ctx-item svg { width: 14px; height: 14px; }
.ctx-item.ctx-danger { color: var(--error); }
.ctx-item.ctx-danger:hover { background: rgba(239,68,68,.08); }
.ctx-divider { height: 1px; background: var(--border-light); margin: 4px 0; }

/* Phase option list in modal */
.phase-option-list { display: flex; flex-direction: column; gap: 6px; }
.phase-option { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px; cursor: pointer; transition: all 0.12s ease; }
.phase-option:hover { border-color: var(--primary); }
.phase-option.active { border-color: var(--primary); background: var(--primary-50); }
.phase-option input { display: none; }
.phase-dot-lg { width: 12px; height: 12px; border-radius: 50%; }

/* Dependency option */
.dep-option { display: flex; align-items: center; gap: 8px; padding: 6px 0; font-size: var(--text-sm); cursor: pointer; }

/* ── List view ──────────────────────────────────────────────────────── */
.schedule-list-wrapper { overflow-x: auto; }
.schedule-list-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  font-size: var(--text-sm);
}
.schedule-list-table th {
  text-align: left;
  padding: 10px 12px;
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  background: var(--border-light);
  border-bottom: 2px solid var(--border);
}
.schedule-list-table td { padding: 10px 12px; border-bottom: 1px solid var(--border-light); vertical-align: middle; }
.schedule-list-row { transition: background 0.1s ease; cursor: default; }
.schedule-list-row:hover { background: var(--primary-50); }
.schedule-list-row.behind { background: rgba(239,68,68,.04); }
.schedule-list-row.behind:hover { background: rgba(239,68,68,.08); }

.phase-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 6px; vertical-align: middle; }
.phase-chip { padding: 2px 10px; border-radius: 12px; font-size: 11px; font-weight: 600; }
.milestone-badge { padding: 2px 8px; border-radius: 10px; font-size: 10px; font-weight: 700; background: #fef3c7; color: #92400e; margin-left: 6px; }
.critical-badge { padding: 2px 8px; border-radius: 10px; font-size: 10px; font-weight: 700; background: rgba(239,68,68,.1); color: #ef4444; margin-left: 4px; }

.list-progress { display: inline-block; width: 60px; height: 6px; background: var(--border-light); border-radius: 3px; overflow: hidden; vertical-align: middle; }
.list-progress-bar { height: 100%; border-radius: 3px; transition: width 0.3s ease; }
.list-progress-label { font-size: 11px; color: var(--text-muted); margin-left: 6px; }

.status-badge { padding: 2px 10px; border-radius: 10px; font-size: 10px; font-weight: 700; }
.status-overdue { background: rgba(239,68,68,.1); color: #ef4444; }
.status-done { background: rgba(16,185,129,.1); color: #10b981; }
.status-active { background: rgba(99,102,241,.1); color: #6366f1; }

.btn-icon {
  background: none; border: none; cursor: pointer; padding: 4px; border-radius: 4px;
  color: var(--text-muted); display: inline-flex; align-items: center; transition: all 0.12s ease;
}
.btn-icon:hover { color: var(--primary); background: var(--primary-50); }
.btn-icon svg { width: 14px; height: 14px; }

/* ── Board view ─────────────────────────────────────────────────────── */
.schedule-board { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.board-column { background: var(--border-light); border-radius: var(--radius); min-height: 300px; }
.board-column-header {
  padding: 12px 14px;
  font-weight: 700;
  font-size: var(--text-sm);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--surface);
  border-radius: var(--radius) var(--radius) 0 0;
}
.board-count { font-size: 11px; padding: 2px 8px; background: var(--border); border-radius: 10px; color: var(--text-muted); }
.board-column-body { padding: 8px; display: flex; flex-direction: column; gap: 8px; }
.board-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.board-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.board-card.behind { border-left: 3px solid var(--error); }
.board-card-header { display: flex; justify-content: space-between; margin-bottom: 4px; }
.board-card-header strong { font-size: 13px; }
.board-card-meta { font-size: 11px; color: var(--text-muted); display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.board-card-progress { height: 4px; background: var(--border-light); border-radius: 2px; overflow: hidden; }
.board-progress-bar { height: 100%; border-radius: 2px; transition: width 0.3s ease; }
.board-progress-label { font-size: 10px; color: var(--text-muted); }
.board-behind-flag { font-size: 10px; color: var(--error); font-weight: 600; margin-top: 4px; }
.board-empty { text-align: center; padding: 30px 10px; font-size: var(--text-sm); color: var(--text-muted); }

/* Progress display in modals */
.progress-display { text-align: center; font-size: 24px; font-weight: 700; color: var(--primary); margin-top: 8px; }

/* Print styles */
@media print {
  .view-header .header-actions, .schedule-toolbar, .schedule-progress-bar { display: none; }
  .gantt-container { border: 1px solid #ccc; }
  .gantt-labels { position: static; }
}


/* ==========================================================================
   19. INVOICING
   ========================================================================== */

.invoice-stats {
  display: flex;
  gap: 16px;
  margin-bottom: 20px;
}

.inv-stat {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: all var(--duration-normal) var(--ease-out);
}
.inv-stat:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.inv-stat span { font-size: var(--text-sm); }
.inv-stat strong { font-size: 18px; }

.view-toggle { display: flex; gap: 0; }

.toggle-btn {
  padding: 7px 16px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: var(--text-sm);
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all var(--duration-fast) ease;
}
.toggle-btn:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.toggle-btn:last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; border-left: none; }
.toggle-btn:hover { background: var(--border-light); }
.toggle-btn.active { background: var(--primary); color: white; border-color: var(--primary); }

.invoice-detail {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.invoice-header-detail { display: flex; justify-content: space-between; margin-bottom: 20px; }
.invoice-meta { text-align: right; font-size: var(--text-base); line-height: 1.8; }
.invoice-brand { margin-bottom: 16px; font-size: var(--text-md); }
.invoice-brand h3 { font-size: var(--text-lg); }
.invoice-client-info { margin-bottom: 20px; font-size: var(--text-md); line-height: 1.6; }

.trade-warning {
  background: var(--warning-light);
  border: 1px solid #fbbf24;
  color: #92400e;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: var(--text-sm);
  font-weight: 600;
  margin-bottom: 16px;
}

.invoice-table { width: 100%; border-collapse: collapse; font-size: var(--text-base); }
.invoice-table th { text-align: left; padding: 8px 10px; border-bottom: 2px solid var(--border); font-size: var(--text-xs); text-transform: uppercase; color: var(--text-muted); }
.invoice-table td { padding: 8px 10px; border-bottom: 1px solid var(--border-light); }
.invoice-table tfoot td { border: none; padding-top: 6px; }
.total-row td { font-size: 15px; padding-top: 10px; border-top: 2px solid var(--border); }
.margin-row td { font-size: var(--text-base); }
.invoice-footer-text { margin-top: 20px; font-size: var(--text-sm); }


/* ==========================================================================
   20. SUPPLIERS — Production
   ========================================================================== */

.view-suppliers { position: relative; }
.suppliers-subtitle { font-size: var(--text-sm); color: var(--text-muted); margin-top: 2px; }

/* Controls */
.supplier-controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}
.supplier-search-row { display: flex; gap: 12px; align-items: center; }

.search-box {
  position: relative;
  display: flex;
  align-items: center;
  max-width: 360px;
}
.search-box-lg { max-width: 480px; flex: 1; }
.search-icon {
  position: absolute;
  left: 10px;
  color: var(--text-muted);
  display: flex;
  pointer-events: none;
}
.search-icon svg { width: 16px; height: 16px; }
.search-box input {
  width: 100%;
  padding: 9px 10px 9px 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: var(--text-base);
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.search-box input:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 3px var(--primary-200);
}
.search-clear {
  position: absolute;
  right: 8px;
  background: none;
  border: none;
  font-size: 18px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0 4px;
}
.search-clear:hover { color: var(--text); }

/* View toggle */
.supplier-view-toggle { display: flex; gap: 0; }
.view-toggle-btn {
  padding: 7px 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  transition: all 0.12s ease;
}
.view-toggle-btn:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.view-toggle-btn:last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; border-left: none; }
.view-toggle-btn:hover { color: var(--primary); }
.view-toggle-btn.active { background: var(--primary); color: white; border-color: var(--primary); }
.view-toggle-btn svg { width: 16px; height: 16px; }

/* Category chips */
.filter-section { margin-bottom: 4px; }
.category-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  padding: 5px 14px;
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: var(--text-sm);
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  background: var(--surface);
  color: var(--text-secondary);
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}
.chip:hover { border-color: var(--primary); color: var(--primary); }
.chip:active { transform: scale(0.96); }
.chip-active { background: var(--primary); color: white; border-color: var(--primary); }
.chip-count { font-size: 10px; opacity: 0.7; }
.cat-chip-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

/* Filter row */
.filter-row { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.filter-item { display: flex; align-items: center; gap: 6px; font-size: var(--text-sm); }
.filter-item label { color: var(--text-secondary); font-weight: 600; white-space: nowrap; }
.filter-item select {
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: var(--text-sm);
  font-family: inherit;
  background: var(--surface);
  cursor: pointer;
}

.rating-filter { display: flex; gap: 2px; }
.rating-filter-btn {
  padding: 3px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  background: var(--surface);
  color: var(--text-secondary);
  transition: all 0.12s ease;
}
.rating-filter-btn:hover { border-color: var(--primary); color: var(--primary); }
.rating-filter-btn.active { background: var(--primary); color: white; border-color: var(--primary); }

.sort-dir-btn {
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 14px;
  cursor: pointer;
  background: var(--surface);
  color: var(--text-muted);
  transition: all 0.12s ease;
}
.sort-dir-btn:hover { color: var(--primary); border-color: var(--primary); }

.supplier-results-count { font-size: var(--text-xs); color: var(--text-muted); margin-bottom: 10px; }

/* ── Supplier Grid Cards ─────────────────────────────────────────── */
.supplier-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: 14px;
}

.supplier-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: all 0.2s ease;
}
.supplier-card:hover { box-shadow: var(--shadow); border-color: var(--primary-light); }
.supplier-card.expanded { box-shadow: var(--shadow-lg); }

.supplier-card-main {
  display: flex;
  align-items: flex-start;
  padding: 16px;
  gap: 14px;
  cursor: pointer;
}

.supplier-logo {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 15px;
  flex-shrink: 0;
}
.supplier-logo-sm {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 11px;
  flex-shrink: 0;
}
.supplier-logo-lg {
  width: 64px;
  height: 64px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 22px;
  flex-shrink: 0;
}

.supplier-card-content { flex: 1; min-width: 0; }
.supplier-card-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 4px; }
.supplier-name { font-size: 15px; font-weight: 700; }
.supplier-name-link { color: var(--text); text-decoration: none; transition: color 0.12s ease; }
.supplier-name-link:hover { color: var(--primary); }

.supplier-badges { display: flex; gap: 6px; flex-shrink: 0; }
.trade-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  background: rgba(16,185,129,.1);
  color: #059669;
  display: flex;
  align-items: center;
  gap: 3px;
}
.trade-badge svg { width: 10px; height: 10px; }
.trade-badge-sm { font-size: 10px; font-weight: 700; color: #059669; }

.supplier-card-meta-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }

.category-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
}
.category-badge-sm { font-size: 10px; font-weight: 700; padding: 1px 8px; border-radius: 8px; }

.stars { display: flex; gap: 1px; align-items: center; }
.star { color: #d4d4d8; transition: color 0.12s ease; display: flex; align-items: center; }
.star.filled { color: #f59e0b; }
.star.half { color: #f59e0b; }
.star svg { width: 14px; height: 14px; }
.star-interactive { cursor: pointer; }
.star-interactive:hover { transform: scale(1.2); }

.lead-time-indicator { font-size: 11px; display: flex; align-items: center; gap: 4px; }
.lead-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }

.supplier-card-stats { display: flex; gap: 8px; flex-wrap: wrap; }
.stat-chip { font-size: 11px; color: var(--text-muted); }
.stat-chip strong { color: var(--text-secondary); }

.supplier-expand-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px;
  border-radius: 4px;
  display: flex;
  flex-shrink: 0;
  margin-top: 4px;
  transition: all 0.12s ease;
}
.supplier-expand-btn:hover { color: var(--primary); background: var(--primary-50); }
.supplier-expand-btn svg { width: 14px; height: 14px; }

/* Expanded details */
.supplier-card-details {
  border-top: 1px solid var(--border-light);
  padding: 0 16px;
}
.supplier-card.expanded .supplier-card-details { padding: 16px; }
.supplier-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.supplier-detail-grid .full-width { grid-column: 1 / -1; }
.detail-section h4 { font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--text-muted); margin-bottom: 6px; letter-spacing: 0.05em; }
.supplier-detail-row { font-size: var(--text-sm); color: var(--text-secondary); margin-bottom: 3px; display: flex; align-items: center; gap: 6px; }
.supplier-detail-row a { color: var(--primary); text-decoration: none; }
.supplier-detail-row a:hover { text-decoration: underline; }
.email-link { color: var(--primary); cursor: pointer; }
.copy-email-btn {
  font-size: 10px;
  padding: 1px 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  cursor: pointer;
  color: var(--text-muted);
  margin-left: 4px;
}
.copy-email-btn:hover { color: var(--primary); border-color: var(--primary); }

.project-chip {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  background: var(--primary-50);
  color: var(--primary);
  border-radius: 8px;
  margin: 0 4px 4px 0;
  font-weight: 600;
}

.supplier-notes { font-size: var(--text-sm); color: var(--text-muted); font-style: italic; margin: 4px 0; line-height: 1.5; }

.supplier-card-actions { display: flex; gap: 8px; flex-wrap: wrap; padding-top: 10px; border-top: 1px solid var(--border-light); }
.btn-danger { color: var(--error) !important; border-color: rgba(239,68,68,.3) !important; }
.btn-danger:hover { background: rgba(239,68,68,.08) !important; }

/* ── Supplier List View ──────────────────────────────────────────── */
.supplier-list-wrapper { overflow-x: auto; }
.supplier-list-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: var(--text-sm);
}
.supplier-list-table th {
  text-align: left;
  padding: 10px 12px;
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  background: var(--border-light);
  border-bottom: 2px solid var(--border);
}
.supplier-list-table td { padding: 10px 12px; border-bottom: 1px solid var(--border-light); vertical-align: middle; }
.supplier-list-row { cursor: pointer; transition: background 0.1s ease; }
.supplier-list-row:hover { background: var(--primary-50); }
.supplier-list-name { display: flex; align-items: center; gap: 10px; }

/* ── Rating selector in form ────────────────────────────────────── */
.rating-selector { display: flex; gap: 2px; align-items: center; }
.rating-star-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: #d4d4d8;
  padding: 2px;
  transition: color 0.12s ease, transform 0.12s ease;
}
.rating-star-btn:hover { transform: scale(1.15); }
.rating-star-btn.active { color: #f59e0b; }
.rating-star-btn svg { width: 20px; height: 20px; }

/* ── Supplier Detail Page ────────────────────────────────────────── */
.supplier-detail-page { max-width: 1100px; }

.breadcrumb { font-size: var(--text-sm); color: var(--text-muted); margin-bottom: 16px; }
.breadcrumb a { color: var(--primary); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb-sep { margin: 0 6px; }

.supplier-detail-header {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
.supplier-detail-title { flex: 1; }
.supplier-detail-title h1 { font-size: 22px; margin-bottom: 8px; }
.supplier-detail-meta { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.supplier-detail-actions { display: flex; gap: 8px; flex-wrap: wrap; flex-shrink: 0; }

/* Metrics */
.supplier-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}
.metric-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  transition: all 0.2s ease;
}
.metric-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.metric-value { font-size: 20px; font-weight: 800; color: var(--text); }
.metric-label { font-size: 11px; color: var(--text-muted); margin-top: 2px; text-transform: uppercase; letter-spacing: 0.05em; }

/* Two column layout */
.supplier-detail-body { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

.detail-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 14px;
}
.detail-card h3 { font-size: 14px; font-weight: 700; margin-bottom: 12px; }

.contact-grid { display: flex; flex-direction: column; gap: 8px; }
.contact-row { display: flex; gap: 8px; font-size: var(--text-sm); }
.contact-label { font-weight: 600; color: var(--text-muted); min-width: 70px; }
.contact-row a { color: var(--primary); text-decoration: none; }
.contact-row a:hover { text-decoration: underline; }

.supplier-notes-edit {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: var(--text-sm);
  font-family: inherit;
  resize: vertical;
  min-height: 80px;
}
.supplier-notes-edit:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px var(--primary-200); }

.project-link-row { display: flex; align-items: center; gap: 8px; font-size: var(--text-sm); padding: 6px 0; }
.project-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--primary); flex-shrink: 0; }

/* Order history */
.order-history-list { display: flex; flex-direction: column; gap: 8px; max-height: 400px; overflow-y: auto; }
.order-history-item { padding: 10px; border: 1px solid var(--border-light); border-radius: 6px; transition: all 0.12s ease; }
.order-history-item:hover { background: var(--border-light); }
.order-history-item.overdue { border-left: 3px solid var(--error); }
.order-item-main { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.order-item-name { font-weight: 600; font-size: 13px; }
.order-item-meta { display: flex; gap: 12px; font-size: 11px; color: var(--text-muted); }
.overdue-flag { font-size: 10px; color: var(--error); font-weight: 700; margin-top: 4px; }

/* Status breakdown */
.status-breakdown { display: flex; flex-direction: column; gap: 8px; }
.status-row { display: flex; align-items: center; gap: 10px; }
.status-label { font-size: 12px; font-weight: 600; min-width: 70px; }
.status-bar-track { flex: 1; height: 6px; background: var(--border-light); border-radius: 3px; overflow: hidden; }
.status-bar-fill { height: 100%; border-radius: 3px; transition: width 0.3s ease; }
.status-count { font-size: 11px; color: var(--text-muted); min-width: 20px; text-align: right; }

/* Responsive */
@media (max-width: 768px) {
  .supplier-grid { grid-template-columns: 1fr; }
  .supplier-detail-body { grid-template-columns: 1fr; }
  .supplier-detail-header { flex-direction: column; }
  .supplier-metrics { grid-template-columns: repeat(2, 1fr); }
  .filter-row { flex-direction: column; align-items: flex-start; }
}


/* ==========================================================================
   21. MOOD BOARD
   ========================================================================== */

.board-tabs { display: flex; gap: 4px; }

.board-tab {
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  font-size: var(--text-sm);
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  background: var(--surface);
  color: var(--text-secondary);
  transition: all var(--duration-normal) var(--ease-out);
}
.board-tab:hover { border-color: var(--primary); color: var(--primary); }
.board-tab.active { background: var(--primary); color: white; border-color: var(--primary); }
.board-tab-add { border-style: dashed; }

.moodboard-toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
  position: sticky;
  top: var(--topbar-h);
  z-index: var(--z-sticky);
  background: var(--bg);
  padding: 8px 0;
}

.toolbar-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: var(--text-sm);
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  background: var(--surface);
  color: var(--text-secondary);
  transition: all var(--duration-fast) ease;
}
.toolbar-btn:hover { border-color: var(--primary); color: var(--primary); }
.toolbar-btn:active { transform: scale(0.97); }
.toolbar-btn.active { background: var(--primary); color: white; border-color: var(--primary); }
.toolbar-btn svg { width: 16px; height: 16px; }
.toolbar-delete { color: var(--error); }
.toolbar-delete:hover { border-color: var(--error); color: var(--error); }

.moodboard-canvas {
  position: relative;
  min-height: 400px;
  background: var(--surface);
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background-image: radial-gradient(circle, var(--border) 1px, transparent 1px);
  background-size: 24px 24px;
}

.mb-item {
  position: absolute;
  cursor: grab;
  user-select: none;
  transition: box-shadow var(--duration-fast) ease;
}
.mb-item:active { cursor: grabbing; }
.mb-item:hover { z-index: 2; }

.mb-selected {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.2);
}

.mb-color-label {
  text-align: center;
  font-size: 10px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.mb-text-item {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  background: var(--border-light);
  border-radius: 6px;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  font-style: italic;
}

.mb-resize-handle {
  position: absolute;
  bottom: -4px;
  right: -4px;
  width: 12px;
  height: 12px;
  background: var(--primary);
  border-radius: 2px;
  cursor: nwse-resize;
  transition: transform var(--duration-fast) ease;
}
.mb-resize-handle:hover { transform: scale(1.2); }


/* ==========================================================================
   22. FLOOR PLAN
   ========================================================================== */

.fp-layout { display: flex; gap: 16px; }

.fp-toolbar {
  width: 180px;
  flex-shrink: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  position: sticky;
  top: calc(var(--topbar-h) + 24px);
  align-self: flex-start;
  max-height: calc(100vh - var(--topbar-h) - 48px);
  overflow-y: auto;
}
.fp-toolbar h4 { font-size: var(--text-xs); text-transform: uppercase; color: var(--text-muted); margin-bottom: 8px; margin-top: 12px; }
.fp-toolbar h4:first-child { margin-top: 0; }
.fp-toolbar .toolbar-btn { width: 100%; justify-content: flex-start; margin-bottom: 4px; }

.furniture-lib { display: flex; flex-direction: column; gap: 6px; }

.furniture-lib-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: var(--text-xs);
  cursor: pointer;
  transition: all var(--duration-fast) ease;
}
.furniture-lib-item:hover {
  border-color: var(--primary);
  background: var(--primary-50);
}
.furn-preview { flex-shrink: 0; }

.fp-canvas-wrapper {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  overflow: auto;
}

.fp-svg { display: block; margin: 0 auto; }

/* Floor plan grid with subtle dots */
.fp-grid-dots {
  fill: url(#fp-dot-pattern);
}

/* Furniture items with inner shadow feel */
.fp-furniture {
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
  transition: filter var(--duration-fast) ease;
}
.fp-furniture:hover {
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.15));
}
.fp-furniture.selected {
  filter: drop-shadow(0 0 8px rgba(99, 102, 241, 0.4));
}

/* Context menu items (mood board + floor plan) */
.ctx-menu-item {
  display: block;
  width: 100%;
  padding: 6px 16px;
  border: none;
  background: none;
  text-align: left;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  color: var(--text);
  transition: background .1s;
}
.ctx-menu-item:hover { background: var(--border-light); }

/* Mood board inline edit */
.mb-inline-edit { font-family: inherit; }

/* Floor plan right panel scrollbar */
.fp-right-panel::-webkit-scrollbar { width: 4px; }
.fp-right-panel::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* Furniture library hover states */
.furniture-lib-item:hover { border-color: var(--primary); background: var(--border-light); }
.furniture-lib-item:active { cursor: grabbing; }


/* ==========================================================================
   23. CLIENT PORTAL — Premium branded client-facing view
   ========================================================================== */

.view-client-portal { max-width: 900px; }

.client-header {
  background: var(--client-bg);
  color: white;
  padding: 32px 24px;
  border-radius: var(--radius) var(--radius) 0 0;
  text-align: center;
  letter-spacing: 0.01em;
}

.client-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: var(--text-base);
  font-weight: 500;
  opacity: 0.7;
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.client-project-name {
  font-family: 'Playfair Display', serif;
  font-size: 32px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.client-sub {
  opacity: 0.6;
  font-size: var(--text-md);
  margin-top: 6px;
  font-weight: 300;
}

.client-tabs {
  display: flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: none;
}

.client-tab {
  flex: 1;
  padding: 12px;
  border: none;
  background: none;
  font-size: var(--text-base);
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  transition: all var(--duration-fast) ease;
}
.client-tab:hover { color: var(--text); background: var(--primary-50); }
.client-tab.active {
  color: var(--client-accent);
  border-bottom-color: var(--client-accent);
  font-weight: 600;
}

.client-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  padding: 28px;
}

.client-overview { text-align: center; }
.client-progress-card { margin-bottom: 20px; }
.client-progress-card h3 { font-size: var(--text-md); margin-bottom: 12px; }

.big-progress { position: relative; display: inline-block; }
.progress-ring { width: 120px; height: 120px; }
.progress-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 24px;
  font-weight: 700;
}
.next-milestone { font-size: var(--text-base); color: var(--text-secondary); margin-top: 12px; }

.client-stats-row { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }
.client-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  min-width: 120px;
  transition: all var(--duration-fast) ease;
}
.client-stat:hover { border-color: var(--border); }
.client-stat span { font-size: var(--text-xs); color: var(--text-muted); }
.client-stat strong { font-size: 15px; }

/* Client portal gold accent buttons */
.client-content .btn-primary {
  background: linear-gradient(135deg, var(--client-accent), #b8942e);
  box-shadow: 0 2px 8px rgba(212, 168, 83, 0.25);
}
.client-content .btn-primary:hover {
  box-shadow: 0 4px 14px rgba(212, 168, 83, 0.35);
}

.client-timeline { padding-left: 20px; border-left: 2px solid var(--border); }
.timeline-item { padding: 12px 0 12px 20px; position: relative; }
.timeline-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--border);
  position: absolute;
  left: -27px;
  top: 16px;
  transition: all var(--duration-normal) ease;
}
.timeline-item.done .timeline-dot { background: var(--success); }
.timeline-item.active .timeline-dot { background: var(--primary); box-shadow: 0 0 0 4px var(--primary-200); }
.timeline-content strong { font-size: var(--text-base); display: block; }
.timeline-content span { font-size: var(--text-xs); color: var(--text-muted); }

.selection-cards { display: flex; flex-direction: column; gap: 10px; }
.selection-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: all var(--duration-fast) ease;
}
.selection-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-xs); }
.selection-info h4 { font-size: var(--text-md); margin-bottom: 2px; }
.selection-actions { display: flex; gap: 6px; }

/* Messages */
.message-list { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }
.message { display: flex; gap: 10px; }
.message-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
  font-weight: 700;
  flex-shrink: 0;
}
.from-designer .message-avatar { background: linear-gradient(135deg, var(--primary), var(--accent)); color: white; }
.message-body strong { font-size: var(--text-sm); display: block; margin-bottom: 2px; }
.message-body p { font-size: var(--text-base); color: var(--text-secondary); }
.message-body span { font-size: var(--text-xs); color: var(--text-muted); }
.message-compose { display: flex; gap: 8px; }
.message-input {
  flex: 1;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: var(--text-base);
  font-family: inherit;
  transition: border-color var(--duration-fast) ease, box-shadow var(--duration-fast) ease;
}
.message-input:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 3px var(--primary-200);
}


/* ==========================================================================
   24. AI CHAT ASSISTANT
   ========================================================================== */

.view-ai {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--topbar-h) - 48px);
}

.ai-badge {
  font-size: var(--text-xs);
  color: var(--accent);
  font-weight: 600;
}

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

.chat-msg {
  display: flex;
  gap: 10px;
  max-width: 80%;
  animation: fadeInUp var(--duration-slow) var(--ease-out) both;
}
.chat-user { align-self: flex-end; flex-direction: row-reverse; }

.chat-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
  font-weight: 700;
  flex-shrink: 0;
}
.chat-assistant .chat-avatar { background: linear-gradient(135deg, var(--primary), var(--accent)); color: white; }
.chat-user .chat-avatar { background: var(--border); color: var(--text); }

.chat-bubble {
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: var(--text-base);
  line-height: 1.5;
  position: relative;
}

/* Chat bubble tails (CSS triangles) */
.chat-assistant .chat-bubble {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top-left-radius: 4px;
}
.chat-assistant .chat-bubble::before {
  content: '';
  position: absolute;
  top: 12px;
  left: -7px;
  width: 0;
  height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-right: 7px solid var(--border);
}
.chat-assistant .chat-bubble::after {
  content: '';
  position: absolute;
  top: 12px;
  left: -6px;
  width: 0;
  height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-right: 7px solid var(--surface);
}

.chat-user .chat-bubble {
  background: var(--primary);
  color: white;
  border-top-right-radius: 4px;
}
.chat-user .chat-bubble::before {
  content: '';
  position: absolute;
  top: 12px;
  right: -7px;
  width: 0;
  height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-left: 7px solid var(--primary);
}

.chat-bubble p { margin-bottom: 6px; }
.chat-bubble p:last-child { margin-bottom: 0; }

.chat-cards { margin-top: 8px; }

.ai-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px;
  transition: all var(--duration-fast) ease;
}
.ai-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-xs); }
.ai-card h4 { font-size: var(--text-sm); color: var(--text-muted); margin-bottom: 4px; }
.ai-card-row { display: flex; justify-content: space-between; padding: 3px 0; font-size: var(--text-sm); }

.ai-card-sm {
  padding: 6px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: var(--text-sm);
  margin-bottom: 4px;
  transition: all var(--duration-fast) ease;
}
.ai-card-sm:hover { border-color: var(--border-strong); }

/* Typing indicator */
.typing-indicator .chat-bubble {
  display: flex;
  gap: 5px;
  padding: 14px 20px;
}
.typing-indicator .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: typing 1.4s infinite ease-in-out;
}
.typing-indicator .dot:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator .dot:nth-child(3) { animation-delay: 0.4s; }

.chat-suggestions {
  display: flex;
  gap: 6px;
  padding: 8px 0;
  flex-wrap: wrap;
}

.suggestion-chip {
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  font-size: var(--text-sm);
  font-family: inherit;
  cursor: pointer;
  background: var(--surface);
  color: var(--text-secondary);
  transition: all var(--duration-normal) var(--ease-out);
}
.suggestion-chip:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-50);
  transform: translateY(-1px);
}
.suggestion-chip:active { transform: scale(0.97); }

.chat-input-bar {
  display: flex;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border-light);
}
.chat-input-bar input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: var(--text-base);
  font-family: inherit;
  transition: border-color var(--duration-fast) ease, box-shadow var(--duration-fast) ease;
}
.chat-input-bar input:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 3px var(--primary-200);
}


/* ==========================================================================
   25. PRESENTATIONS
   ========================================================================== */

.pres-layout { display: flex; gap: 16px; }
.pres-actions { display: flex; gap: 8px; }

.slide-sorter {
  width: 160px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.slide-thumb {
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  font-size: var(--text-xs);
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all var(--duration-normal) var(--ease-out);
}
.slide-thumb:hover { border-color: var(--primary); background: var(--primary-50); }
.slide-thumb.active { border-color: var(--primary); background: var(--primary-100); }

.slide-num {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  flex-shrink: 0;
  transition: all var(--duration-fast) ease;
}
.slide-thumb.active .slide-num { background: var(--primary); color: white; }
.slide-thumb-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.slide-preview {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  align-items: stretch;
  overflow: hidden;
  /* 16:9 aspect ratio container */
  aspect-ratio: 16 / 9;
  min-height: 0;
}

.slide {
  width: 100%;
  padding: 40px;
  display: flex;
  flex-direction: column;
  animation: fadeIn var(--duration-normal) ease both;
}

.slide-cover {
  align-items: center;
  justify-content: center;
  text-align: center;
  background: linear-gradient(135deg, #fafafe, #f0f0ff);
}
.slide-brand { display: flex; align-items: center; gap: 8px; font-size: var(--text-md); font-weight: 600; color: var(--text-muted); margin-bottom: 24px; }
.slide-title { font-family: 'Playfair Display', serif; font-size: 32px; margin-bottom: 8px; }
.slide-subtitle { font-size: var(--text-lg); color: var(--text-secondary); }
.slide-address { font-size: var(--text-base); color: var(--text-muted); margin-top: 4px; }

.slide-moodboard h2 { font-size: 18px; margin-bottom: 16px; }
.slide-board { display: flex; flex-wrap: wrap; gap: 12px; }
.slide-color { width: 80px; height: 80px; border-radius: var(--radius-sm); display: flex; align-items: flex-end; justify-content: center; }
.slide-color span { font-size: 10px; color: white; text-shadow: 0 1px 3px rgba(0,0,0,.5); padding-bottom: 6px; }
.slide-text-item { font-size: var(--text-base); color: var(--text-secondary); font-style: italic; background: var(--bg); padding: 8px 12px; border-radius: 6px; width: 100%; }
.slide-image { width: 120px; height: 120px; border-radius: var(--radius-sm); overflow: hidden; }
.slide-image img { width: 100%; height: 100%; object-fit: cover; }

.slide-spec h2 { font-size: 18px; margin-bottom: 12px; }
.slide-table { font-size: var(--text-sm); }
.slide-table th { text-align: left; padding: 6px 8px; border-bottom: 2px solid var(--border); font-size: 10px; text-transform: uppercase; color: var(--text-muted); }
.slide-table td { padding: 6px 8px; border-bottom: 1px solid var(--border-light); }

.slide-budget h2 { font-size: 18px; margin-bottom: 16px; }
.budget-chart { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.budget-bar-row { display: flex; align-items: center; gap: 12px; }
.budget-room { width: 120px; font-size: var(--text-sm); font-weight: 500; text-align: right; }
.budget-bar { flex: 1; height: 20px; background: var(--border-light); border-radius: var(--radius-xs); overflow: hidden; }
.budget-bar-fill { height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent)); border-radius: var(--radius-xs); transition: width 0.6s var(--ease-out); }
.budget-val { font-size: var(--text-sm); font-weight: 600; width: 80px; }
.budget-total { display: flex; justify-content: space-between; font-size: var(--text-md); font-weight: 600; border-top: 2px solid var(--border); padding-top: 12px; }


/* ==========================================================================
   26. SETTINGS & NOTIFICATIONS
   ========================================================================== */

.settings-sections { display: flex; flex-direction: column; gap: 20px; }

.settings-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: box-shadow var(--duration-fast) ease;
}
.settings-section:hover { box-shadow: var(--shadow-xs); }
.settings-section h3 { font-size: 15px; margin-bottom: 12px; }

.shortcuts-list { display: flex; flex-direction: column; gap: 8px; }
.shortcut { display: flex; align-items: center; gap: 8px; font-size: var(--text-base); }
.shortcut kbd {
  background: var(--bg);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: var(--radius-xs);
  padding: 2px 8px;
  font-size: var(--text-xs);
  font-family: inherit;
  font-weight: 600;
  color: var(--text-secondary);
}
.shortcut span { color: var(--text-secondary); margin-left: 4px; }

.settings-danger {
  color: var(--error);
  border-color: var(--error);
  transition: all var(--duration-fast) ease;
}
.settings-danger:hover { background: var(--error-light); }

/* Notifications */
.notif-list { max-height: 300px; overflow-y: auto; }
.notif-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
  transition: background var(--duration-fast) ease;
}
.notif-item:last-child { border: none; }
.notif-item:hover { background: var(--primary-50); margin: 0 -10px; padding-left: 10px; padding-right: 10px; border-radius: var(--radius-sm); }
.notif-item.unread { font-weight: 500; }
.notif-item.unread::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary);
  margin-right: 6px;
  vertical-align: middle;
}
.notif-item strong { font-size: var(--text-base); display: block; margin-bottom: 2px; }
.notif-item p { font-size: var(--text-sm); color: var(--text-secondary); }


/* ==========================================================================
   27. SCROLLBAR STYLING
   ========================================================================== */

/* Webkit browsers (Chrome, Safari, Edge) */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

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

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

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

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

/* Don't show scrollbar on sidebar unless hovered */
.app-sidebar::-webkit-scrollbar-thumb {
  background: transparent;
}
.app-sidebar:hover::-webkit-scrollbar-thumb {
  background: var(--border-strong);
}


/* ==========================================================================
   28. FOCUS MANAGEMENT & ACCESSIBILITY
   ========================================================================== */

/* Visible focus ring for keyboard navigation */
*:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Remove focus ring for mouse users */
*:focus:not(:focus-visible) {
  outline: none;
}

/* Specific overrides where the ring conflicts with design */
.btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px var(--primary-200);
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none; /* Handled by box-shadow instead */
}

/* Reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .app-main > * { animation: none; }
}


/* ==========================================================================
   29. PRINT STYLES
   ========================================================================== */

@media print {
  /* Hide non-content elements */
  .app-sidebar,
  .app-topbar,
  .topbar-menu-btn,
  .sidebar-backdrop,
  .modal-container,
  .toast-container,
  .view-header .btn,
  .chat-input-bar,
  .chat-suggestions,
  .moodboard-toolbar,
  .fp-toolbar,
  .pres-actions,
  .slide-sorter,
  .table-controls .btn,
  .icon-btn,
  .skip-to-content,
  .initial-loading {
    display: none !important;
  }

  /* Full-width content */
  .app-content {
    margin-left: 0 !important;
  }

  .app-main {
    padding: 0 !important;
    overflow: visible !important;
  }

  /* Remove backgrounds from badges for ink saving */
  .status-badge {
    background: none !important;
    border: 1px solid currentColor;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  /* Remove shadows */
  .stat-card,
  .dash-panel,
  .supplier-card,
  .settings-section,
  .modal,
  .toast {
    box-shadow: none !important;
  }

  /* Proper borders for tables */
  .data-table,
  .invoice-table {
    border: 1px solid #ccc;
  }
  .data-table th,
  .data-table td,
  .invoice-table th,
  .invoice-table td {
    border: 1px solid #ddd;
  }

  /* No background on cards */
  .stat-card,
  .dash-panel,
  .settings-section {
    border: 1px solid #ccc;
  }

  /* Ensure slide preview prints well */
  .slide-preview {
    border: none !important;
    break-inside: avoid;
  }

  /* Page break control */
  .dash-panel,
  .settings-section,
  .supplier-card {
    break-inside: avoid;
  }

  h1, h2, h3 {
    break-after: avoid;
  }

  /* Invoice prints at full width */
  .invoice-detail {
    border: none;
    padding: 0;
  }

  /* Force background colors for status items in print */
  .phase-structural,
  .phase-firstfix,
  .phase-finishing,
  .phase-install,
  .stat-progress-bar,
  .mini-progress-bar {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  /* Links show URL */
  a[href]:not(.btn)::after {
    content: " (" attr(href) ")";
    font-size: 10px;
    color: #666;
  }

  /* Page margins */
  @page {
    margin: 1.5cm;
  }
}


/* ==========================================================================
   30. RESPONSIVE: 1200px (2-column adjustments)
   ========================================================================== */

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

  .dash-grid {
    grid-template-columns: 1fr 1fr;
  }

  .supplier-grid {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  }

  .quick-links {
    grid-template-columns: 1fr 1fr;
  }

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


/* ==========================================================================
   31. RESPONSIVE: 768px (Tablet — sidebar collapses)
   ========================================================================== */

@media (max-width: 768px) {
  .app-sidebar {
    transform: translateX(-100%);
    box-shadow: none;
  }
  .app-sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-xl);
  }

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

  .topbar-menu-btn { display: flex; }
  .topbar-search { display: none; }

  .topbar-breadcrumb .topbar-project,
  .topbar-breadcrumb .topbar-sep {
    display: none;
  }

  .stats-grid { grid-template-columns: 1fr 1fr; }
  .dash-grid { grid-template-columns: 1fr; }
  .invoice-stats { flex-direction: column; }
  .summary-bar { flex-wrap: wrap; gap: 12px; }

  .fp-layout { flex-direction: column; }
  .fp-toolbar { width: 100%; flex-direction: row; flex-wrap: wrap; position: static; max-height: none; }

  .pres-layout { flex-direction: column; }
  .slide-sorter { width: 100%; flex-direction: row; overflow-x: auto; }
  .slide-preview { aspect-ratio: auto; min-height: 350px; }

  .gantt-labels { width: 140px; }

  .form-grid { grid-template-columns: 1fr; }

  .chat-msg { max-width: 90%; }

  .client-stats-row { flex-direction: column; align-items: center; }

  .initial-loading .skeleton-sidebar { display: none; }
  .initial-loading .skeleton-stats { grid-template-columns: 1fr 1fr; }
  .initial-loading .skeleton-panels { grid-template-columns: 1fr; }

  .moodboard-toolbar { position: static; }

  .pipeline-bar { overflow-x: auto; -webkit-overflow-scrolling: touch; }

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


/* ==========================================================================
   32. RESPONSIVE: 480px (Mobile — single column)
   ========================================================================== */

@media (max-width: 480px) {
  .app-main { padding: 16px; }
  .app-topbar { padding: 0 16px; }

  h1, .view-header h1, .view-dashboard h1 { font-size: 18px; }

  .stats-grid { grid-template-columns: 1fr; gap: 10px; }
  .stat-card { padding: 14px; }
  .stat-value { font-size: 20px; }

  .quick-links { grid-template-columns: 1fr; }

  .view-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .supplier-grid { grid-template-columns: 1fr; }
  .supplier-card { padding: 12px; }

  .btn { padding: 8px 14px; font-size: var(--text-sm); }
  .btn-lg { padding: 10px 18px; font-size: var(--text-base); }

  .filter-group { flex-wrap: wrap; }
  .category-chips { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; }

  .modal { width: 95%; max-height: 90vh; }
  .modal-body { padding: 16px; }
  .modal-header { padding: 14px 16px; }
  .modal-footer { padding: 10px 16px; }

  .slide { padding: 20px; }
  .slide-title { font-size: 24px; }

  .client-header { padding: 20px 16px; }
  .client-project-name { font-size: 24px; }
  .client-content { padding: 16px; }

  .pres-actions { flex-wrap: wrap; }

  .invoice-header-detail { flex-direction: column; gap: 12px; }
  .invoice-meta { text-align: left; }

  .gantt-labels { width: 120px; }
  .gantt-label { padding: 4px 8px; }
  .gantt-task-name { font-size: var(--text-xs); }
  .gantt-task-contractor { font-size: 9px; }

  .initial-loading .skeleton-stats { grid-template-columns: 1fr; }
}


/* ==========================================================================
   33. FULLSCREEN
   ========================================================================== */

.slide-preview:fullscreen {
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: auto;
}
.slide-preview:fullscreen .slide {
  max-width: 900px;
  margin: 0 auto;
}


/* ==========================================================================
   34. CLIENT PORTAL — NEW portal-* STYLES
   ========================================================================== */

/* ── Container ──────────────────────────────────────────────────────────── */

.view-client-portal {
  max-width: 960px;
  margin: 0 auto;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ── Hero Header ────────────────────────────────────────────────────────── */

.portal-hero {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 60%, #1a2332 100%);
  color: #fff;
  padding: 48px 32px 40px;
  border-radius: var(--radius, 12px) var(--radius, 12px) 0 0;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.portal-hero::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: radial-gradient(ellipse at 30% 20%, rgba(201,169,110,0.08) 0%, transparent 60%),
              radial-gradient(ellipse at 70% 80%, rgba(201,169,110,0.05) 0%, transparent 50%);
  pointer-events: none;
}

.portal-hero-inner {
  position: relative;
  z-index: 1;
}

.portal-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  opacity: 0.7;
  margin-bottom: 16px;
}

.portal-project-name {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 34px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 8px;
  line-height: 1.2;
}

.portal-welcome {
  font-size: 16px;
  opacity: 0.75;
  margin: 0 0 4px;
  font-weight: 300;
}

.portal-address {
  font-size: 13px;
  opacity: 0.5;
  margin: 0;
  font-weight: 400;
}

/* ── Tabs ────────────────────────────────────────────────────────────────── */

.portal-tabs {
  display: flex;
  gap: 0;
  background: #fff;
  border: 1px solid var(--border, #e2e8f0);
  border-top: none;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.portal-tabs::-webkit-scrollbar { display: none; }

.portal-tab {
  flex: 1;
  min-width: max-content;
  padding: 14px 20px;
  border: none;
  background: none;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  color: var(--text-secondary, #64748b);
  border-bottom: 2.5px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
  white-space: nowrap;
  position: relative;
}
.portal-tab:hover {
  color: var(--text, #1e293b);
  background: rgba(201, 169, 110, 0.04);
}
.portal-tab.active {
  color: #c9a96e;
  border-bottom-color: #c9a96e;
  font-weight: 600;
}

.portal-tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 99px;
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  margin-left: 6px;
  line-height: 1;
}

/* ── Content Container ──────────────────────────────────────────────────── */

.portal-content {
  background: #f8fafc;
  border: 1px solid var(--border, #e2e8f0);
  border-top: none;
  border-radius: 0 0 var(--radius, 12px) var(--radius, 12px);
  padding: 28px;
  min-height: 400px;
}

/* ── Card Base ──────────────────────────────────────────────────────────── */

.portal-card {
  background: #fff;
  border: 1px solid var(--border-light, #f1f5f9);
  border-radius: 10px;
  padding: 24px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.02);
  transition: box-shadow 0.2s ease;
}
.portal-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.04);
}
.portal-card h3 {
  font-size: 16px;
  font-weight: 600;
  color: #1e293b;
  margin: 0 0 16px;
}

/* ── Grid Layouts ───────────────────────────────────────────────────────── */

.portal-overview {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.portal-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.portal-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

/* ── Progress Ring ──────────────────────────────────────────────────────── */

.portal-card-progress {
  text-align: center;
}

.portal-progress-ring-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 140px;
  height: 140px;
  max-width: 140px;
  max-height: 140px;
  margin: 8px auto 12px;
}

.portal-progress-ring {
  width: 140px;
  height: 140px;
  max-width: 140px;
  max-height: 140px;
}

.portal-progress-arc {
  transition: stroke-dasharray 1.2s ease-out;
}

.portal-progress-label {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: baseline;
  gap: 1px;
}

.portal-progress-num {
  font-size: 36px;
  font-weight: 700;
  color: #1e293b;
  line-height: 1;
}

.portal-progress-pct {
  font-size: 18px;
  font-weight: 600;
  color: #94a3b8;
}

.portal-progress-status {
  font-size: 13px;
  color: var(--text-secondary, #64748b);
  margin: 0;
  font-weight: 500;
}

/* ── Milestone Card ─────────────────────────────────────────────────────── */

.portal-card-milestone {
  text-align: center;
}

.portal-milestone-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.portal-milestone-icon {
  margin-bottom: 4px;
}

.portal-milestone-hero h4 {
  font-size: 18px;
  font-weight: 600;
  color: #1e293b;
  margin: 0;
}

.portal-milestone-dates {
  font-size: 13px;
  color: var(--text-secondary, #64748b);
  margin: 0;
}

.portal-countdown {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 4px;
}

.portal-countdown-num {
  font-size: 42px;
  font-weight: 700;
  color: #c9a96e;
  line-height: 1;
}

.portal-countdown-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary, #64748b);
  font-weight: 500;
}

.portal-milestone-contractor {
  font-size: 12px;
  color: var(--text-muted, #94a3b8);
  margin: 4px 0 0;
}

/* ── Timeline Bar (Overview) ────────────────────────────────────────────── */

.portal-card-timeline h3 {
  margin-bottom: 20px;
}

.portal-timeline-bar-wrap {
  padding: 0 4px;
}

.portal-timeline-labels {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-secondary, #64748b);
  margin-bottom: 8px;
  font-weight: 500;
}

.portal-timeline-bar {
  position: relative;
  height: 8px;
  background: #f1f5f9;
  border-radius: 99px;
  overflow: visible;
}

.portal-timeline-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: linear-gradient(90deg, #c9a96e, #b8942e);
  border-radius: 99px;
  transition: width 0.6s ease-out;
}

.portal-timeline-today {
  position: absolute;
  top: -6px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
}
.portal-timeline-today::before {
  content: '';
  width: 12px;
  height: 12px;
  background: #c9a96e;
  border: 3px solid #fff;
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(201,169,110,0.4);
  display: block;
}

.portal-timeline-today-label {
  font-size: 10px;
  font-weight: 600;
  color: #c9a96e;
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.portal-timeline-marker {
  position: absolute;
  top: -3px;
  width: 6px;
  height: 14px;
  background: #cbd5e1;
  border-radius: 3px;
  transform: translateX(-50%);
}

/* ── Stat Cards ─────────────────────────────────────────────────────────── */

.portal-stat-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
  padding: 20px 16px;
}

.portal-stat-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(201,169,110,0.08);
  border-radius: 10px;
  margin-bottom: 4px;
}

.portal-stat-value {
  font-size: 16px;
  font-weight: 700;
  color: #1e293b;
}

.portal-stat-label {
  font-size: 12px;
  color: var(--text-secondary, #64748b);
  font-weight: 500;
}

/* ── Colour Palette ─────────────────────────────────────────────────────── */

.portal-palette-grid {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.portal-palette-swatch {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.portal-swatch-color {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.08);
}

.portal-swatch-label {
  font-size: 11px;
  color: var(--text-secondary, #64748b);
  font-weight: 500;
  text-align: center;
  max-width: 64px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Schedule Tab — Vertical Timeline ───────────────────────────────────── */

.portal-schedule {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.portal-vertical-timeline {
  position: relative;
  padding-left: 0;
}

.portal-phase-group {
  margin-bottom: 24px;
}
.portal-phase-group:last-child {
  margin-bottom: 0;
}

.portal-phase-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.portal-phase-header h4 {
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #1e293b;
  margin: 0;
}

.portal-phase-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #c9a96e;
  flex-shrink: 0;
}

.portal-timeline-task {
  display: flex;
  gap: 0;
  margin-left: 4px;
  position: relative;
}

.portal-timeline-task-line {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 28px;
  flex-shrink: 0;
  position: relative;
}
.portal-timeline-task-line::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
  background: #e2e8f0;
  transform: translateX(-50%);
}
.portal-phase-group:last-child .portal-timeline-task:last-child .portal-timeline-task-line::before {
  height: 50%;
}

.portal-timeline-task-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #e2e8f0;
  position: relative;
  z-index: 1;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 4px;
}
.portal-timeline-task-dot.done {
  background: #22c55e;
}
.portal-timeline-task-dot.active {
  background: #c9a96e;
  box-shadow: 0 0 0 4px rgba(201,169,110,0.2);
}
.portal-timeline-task-dot.future {
  background: #e2e8f0;
}

.portal-pulse {
  display: block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fff;
  animation: portal-pulse-anim 1.5s ease-in-out infinite;
}
@keyframes portal-pulse-anim {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.7); }
}

.portal-timeline-task-content {
  flex: 1;
  padding: 4px 0 16px 12px;
  min-width: 0;
}

.portal-timeline-task-header {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.portal-timeline-task-header strong {
  font-size: 14px;
  color: #1e293b;
}

.portal-contractor-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 99px;
  background: rgba(201,169,110,0.1);
  color: #92722a;
}

.portal-timeline-task-dates {
  font-size: 12px;
  color: var(--text-muted, #94a3b8);
  display: block;
  margin-top: 2px;
}

.portal-timeline-task.done .portal-timeline-task-header strong {
  color: var(--text-secondary, #64748b);
}

.portal-task-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.portal-task-progress-bar {
  flex: 1;
  height: 6px;
  background: #f1f5f9;
  border-radius: 99px;
  overflow: hidden;
  max-width: 200px;
}

.portal-task-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #c9a96e, #b8942e);
  border-radius: 99px;
  transition: width 0.4s ease-out;
}

.portal-task-progress-label {
  font-size: 12px;
  font-weight: 600;
  color: #c9a96e;
  min-width: 32px;
}

/* ── Selections Tab ─────────────────────────────────────────────────────── */

.portal-selections {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.portal-room-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.portal-room-tab {
  padding: 7px 16px;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 99px;
  background: #fff;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  color: var(--text-secondary, #64748b);
  transition: all 0.2s ease;
}
.portal-room-tab:hover {
  border-color: #c9a96e;
  color: #c9a96e;
}
.portal-room-tab.active {
  background: #c9a96e;
  border-color: #c9a96e;
  color: #fff;
}

.portal-selection-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.portal-selection-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: #fff;
  border: 1px solid var(--border-light, #f1f5f9);
  border-radius: 10px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
  transition: all 0.2s ease;
}
.portal-selection-card:hover {
  border-color: var(--border, #e2e8f0);
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.portal-selection-image {
  width: 72px;
  height: 72px;
  flex-shrink: 0;
  border-radius: 8px;
  overflow: hidden;
  background: #f8fafc;
}

.portal-selection-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f1f5f9;
}

.portal-selection-info {
  flex: 1;
  min-width: 0;
}
.portal-selection-info h4 {
  font-size: 15px;
  font-weight: 600;
  color: #1e293b;
  margin: 0 0 4px;
}

.portal-selection-meta {
  font-size: 13px;
  color: var(--text-secondary, #64748b);
  margin: 0 0 6px;
}

.portal-selection-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 99px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.portal-selection-badge.approved {
  background: #dcfce7;
  color: #166534;
}
.portal-selection-badge.pending {
  background: #fef3c7;
  color: #92400e;
}
.portal-selection-badge.change {
  background: #dbeafe;
  color: #1e40af;
}

.portal-selection-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.portal-change-note {
  font-size: 12px;
  color: #3b82f6;
  font-weight: 500;
  font-style: italic;
}

/* ── Buttons ────────────────────────────────────────────────────────────── */

.portal-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  line-height: 1.4;
}

.portal-btn-gold {
  background: linear-gradient(135deg, #c9a96e 0%, #b8942e 100%);
  color: #fff;
  box-shadow: 0 2px 8px rgba(201,169,110,0.3);
}
.portal-btn-gold:hover {
  box-shadow: 0 4px 14px rgba(201,169,110,0.45);
  transform: translateY(-1px);
}

.portal-btn-outline {
  background: #fff;
  color: var(--text-secondary, #64748b);
  border: 1px solid var(--border, #e2e8f0);
}
.portal-btn-outline:hover {
  border-color: #c9a96e;
  color: #c9a96e;
}

.portal-btn-sm {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 6px;
}

.portal-btn-disabled {
  opacity: 0.5;
  pointer-events: none;
}

/* ── Invoices Tab ───────────────────────────────────────────────────────── */

.portal-invoices {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.portal-invoice-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.portal-invoice-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid #f1f5f9;
  transition: background 0.15s ease;
  cursor: default;
}
.portal-invoice-row:last-child {
  border-bottom: none;
}
.portal-invoice-row:hover {
  background: rgba(201,169,110,0.02);
}

.portal-invoice-main {
  flex: 1;
  min-width: 0;
}
.portal-invoice-main strong {
  display: block;
  font-size: 14px;
  color: #1e293b;
}

.portal-invoice-date {
  font-size: 12px;
  color: var(--text-muted, #94a3b8);
}

.portal-invoice-amount {
  font-size: 16px;
  font-weight: 700;
  color: #1e293b;
  min-width: 90px;
  text-align: right;
}

.portal-invoice-status {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  min-width: 64px;
  text-align: center;
}
.portal-invoice-status.paid { background: #dcfce7; color: #166534; }
.portal-invoice-status.overdue { background: #fee2e2; color: #991b1b; }
.portal-invoice-status.sent { background: #dbeafe; color: #1e40af; }
.portal-invoice-status.draft { background: #f1f5f9; color: #475569; }

/* ── Invoice Detail ─────────────────────────────────────────────────────── */

.portal-invoice-detail {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.portal-invoice-sheet {
  background: #fff;
  border: 1px solid var(--border-light, #f1f5f9);
  border-radius: 10px;
  padding: 32px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.portal-invoice-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 24px;
}
.portal-invoice-header h2 {
  font-size: 22px;
  font-weight: 700;
  color: #1e293b;
  margin: 0 0 2px;
}
.portal-invoice-header .text-muted {
  color: var(--text-secondary, #64748b);
  font-size: 13px;
}

.portal-invoice-number {
  text-align: right;
}
.portal-invoice-number h3 {
  font-size: 18px;
  color: #1e293b;
  margin: 0 0 6px;
}

.portal-invoice-meta {
  display: flex;
  gap: 24px;
  margin-bottom: 20px;
  font-size: 13px;
  color: var(--text-secondary, #64748b);
}

.portal-invoice-table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
}
.portal-invoice-table th {
  padding: 10px 12px;
  text-align: left;
  background: #f8fafc;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary, #64748b);
  border-bottom: 2px solid #e2e8f0;
}
.portal-invoice-table td {
  padding: 10px 12px;
  font-size: 14px;
  color: #334155;
  border-bottom: 1px solid #f1f5f9;
}
.portal-invoice-table .text-right {
  text-align: right;
}
.portal-invoice-table tfoot td {
  border-bottom: none;
  padding-top: 8px;
}

.portal-invoice-total-row td {
  border-top: 2px solid #1e293b;
  font-size: 16px;
  padding-top: 12px;
}

.portal-invoice-notes {
  margin-top: 16px;
  font-size: 13px;
  color: var(--text-secondary, #64748b);
  line-height: 1.5;
}

.portal-invoice-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

/* ── Messages Tab ───────────────────────────────────────────────────────── */

.portal-messages {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.portal-messages-card {
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}

.portal-messages-header {
  padding: 16px 24px;
  border-bottom: 1px solid #f1f5f9;
}
.portal-messages-header h3 {
  margin: 0;
}

.portal-message-list {
  flex: 1;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: 480px;
  overflow-y: auto;
  scroll-behavior: smooth;
}

.portal-msg {
  display: flex;
  gap: 10px;
  max-width: 85%;
  animation: portal-msg-in 0.25s ease-out;
}
@keyframes portal-msg-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.portal-msg-designer {
  align-self: flex-start;
}

.portal-msg-client {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.portal-msg-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
  text-transform: uppercase;
}

.portal-avatar-designer {
  background: linear-gradient(135deg, #1e293b, #334155);
  color: #c9a96e;
}

.portal-avatar-client {
  background: linear-gradient(135deg, #c9a96e, #b8942e);
  color: #fff;
}

.portal-msg-bubble {
  padding: 10px 14px;
  border-radius: 12px;
  position: relative;
}
.portal-msg-designer .portal-msg-bubble {
  background: #f1f5f9;
  border-bottom-left-radius: 4px;
}
.portal-msg-client .portal-msg-bubble {
  background: #1e293b;
  color: #fff;
  border-bottom-right-radius: 4px;
}

.portal-msg-name {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 3px;
  color: #475569;
}
.portal-msg-client .portal-msg-name {
  color: rgba(255,255,255,0.6);
}

.portal-msg-bubble p {
  font-size: 14px;
  line-height: 1.5;
  margin: 0;
}

.portal-msg-time {
  font-size: 11px;
  color: #94a3b8;
  display: block;
  margin-top: 4px;
}
.portal-msg-client .portal-msg-time {
  color: rgba(255,255,255,0.4);
}

/* Typing indicator */
.portal-typing-indicator {
  display: flex;
  gap: 10px;
  align-self: flex-start;
}
.portal-typing-indicator.hidden {
  display: none;
}

.portal-typing-bubble {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 16px !important;
}

.typing-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #94a3b8;
  animation: portal-typing 1.2s ease-in-out infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.15s; }
.typing-dot:nth-child(3) { animation-delay: 0.3s; }
@keyframes portal-typing {
  0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-4px); }
}

/* Compose bar */
.portal-compose {
  display: flex;
  gap: 8px;
  padding: 16px 24px;
  border-top: 1px solid #f1f5f9;
  background: #fafbfc;
}

.portal-message-input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  outline: none;
}
.portal-message-input:focus {
  border-color: #c9a96e;
  box-shadow: 0 0 0 3px rgba(201,169,110,0.12);
}
.portal-message-input::placeholder {
  color: #94a3b8;
}

.portal-send-btn {
  width: 42px;
  height: 42px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  flex-shrink: 0;
}
.portal-send-btn svg {
  width: 18px;
  height: 18px;
}

/* ── Documents Tab ──────────────────────────────────────────────────────── */

.portal-documents {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.portal-docs-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}
.portal-docs-header h3 {
  margin-bottom: 0;
}

.portal-doc-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.portal-doc-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid #f1f5f9;
  transition: background 0.15s ease;
}
.portal-doc-row:last-child {
  border-bottom: none;
}
.portal-doc-row:hover {
  background: rgba(201,169,110,0.02);
}

.portal-doc-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(201,169,110,0.06);
  border-radius: 8px;
  flex-shrink: 0;
}

.portal-doc-info {
  flex: 1;
  min-width: 0;
}
.portal-doc-info strong {
  display: block;
  font-size: 14px;
  color: #1e293b;
}

.portal-doc-meta {
  font-size: 12px;
  color: var(--text-muted, #94a3b8);
  display: block;
  margin-top: 2px;
}

/* ── Change Request Modal ───────────────────────────────────────────────── */

.portal-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: portal-overlay-in 0.2s ease-out;
}
@keyframes portal-overlay-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.portal-modal {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  width: 90%;
  max-width: 480px;
  overflow: hidden;
  animation: portal-modal-in 0.25s ease-out;
}
@keyframes portal-modal-in {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.portal-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
}
.portal-modal-header h3 {
  font-size: 18px;
  font-weight: 600;
  color: #1e293b;
  margin: 0;
}

.portal-modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: #f1f5f9;
  border-radius: 8px;
  font-size: 20px;
  color: #64748b;
  cursor: pointer;
  transition: all 0.15s ease;
}
.portal-modal-close:hover {
  background: #e2e8f0;
  color: #1e293b;
}

.portal-modal-body {
  padding: 0 24px 16px;
}
.portal-modal-body p {
  font-size: 14px;
  color: var(--text-secondary, #64748b);
  margin: 0 0 12px;
  line-height: 1.5;
}

.portal-textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  min-height: 80px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  outline: none;
  box-sizing: border-box;
}
.portal-textarea:focus {
  border-color: #c9a96e;
  box-shadow: 0 0 0 3px rgba(201,169,110,0.12);
}

.portal-modal-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 16px 24px 20px;
  background: #fafbfc;
  border-top: 1px solid #f1f5f9;
}

/* ── Portal Responsive: Tablet (768px) ──────────────────────────────────── */

@media (max-width: 768px) {
  .portal-hero {
    padding: 32px 20px 28px;
  }
  .portal-project-name {
    font-size: 26px;
  }
  .portal-content {
    padding: 20px 16px;
  }
  .portal-grid-2 {
    grid-template-columns: 1fr;
  }
  .portal-grid-3 {
    grid-template-columns: 1fr;
  }
  .portal-selection-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .portal-selection-image {
    width: 100%;
    height: 120px;
  }
  .portal-selection-actions {
    width: 100%;
  }
  .portal-selection-actions .portal-btn {
    flex: 1;
    justify-content: center;
  }
  .portal-invoice-row {
    flex-wrap: wrap;
    gap: 8px;
  }
  .portal-invoice-amount {
    text-align: left;
  }
  .portal-invoice-sheet {
    padding: 20px;
  }
  .portal-invoice-header {
    flex-direction: column;
    gap: 12px;
  }
  .portal-invoice-number {
    text-align: left;
  }
  .portal-invoice-meta {
    flex-direction: column;
    gap: 4px;
  }
  .portal-msg {
    max-width: 95%;
  }
  .portal-message-list {
    padding: 16px;
    max-height: 400px;
  }
  .portal-compose {
    padding: 12px 16px;
  }
}

/* ── Portal Responsive: Mobile (480px) ──────────────────────────────────── */

@media (max-width: 480px) {
  .portal-hero {
    padding: 24px 16px 20px;
    border-radius: 0;
  }
  .portal-project-name {
    font-size: 22px;
  }
  .portal-tabs {
    border-radius: 0;
  }
  .portal-tab {
    padding: 12px 14px;
    font-size: 13px;
  }
  .portal-content {
    padding: 16px 12px;
    border-radius: 0 0 8px 8px;
  }
  .portal-card {
    padding: 16px;
  }
  .portal-progress-ring-wrap {
    width: 120px;
    height: 120px;
  }
  .portal-progress-ring {
    width: 120px;
    height: 120px;
  }
  .portal-progress-num {
    font-size: 28px;
  }
  .portal-countdown-num {
    font-size: 32px;
  }
  .portal-doc-row {
    flex-wrap: wrap;
    gap: 8px;
  }
  .portal-modal {
    width: 95%;
    border-radius: 12px;
  }
}


/* ==========================================================================
   NEW: AI ASSISTANT — Production chat styles
   ========================================================================== */

.view-ai { display: flex; flex-direction: column; height: calc(100vh - var(--topbar-h) - 48px); }
.ai-powered-badge { font-size: 12px; color: var(--accent); font-weight: 600; }

.ai-chat-container { flex: 1; overflow-y: auto; padding: 16px 0; display: flex; flex-direction: column; gap: 16px; scroll-behavior: smooth; }

.ai-msg { display: flex; gap: 10px; max-width: 85%; animation: fadeInUp 0.3s ease both; }
.ai-msg-user { align-self: flex-end; flex-direction: row-reverse; }
.ai-msg-assistant { align-self: flex-start; }
.ai-msg-avatar-wrap { flex-shrink: 0; }
.ai-msg-avatar { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.ai-avatar-bot { background: linear-gradient(135deg, var(--primary), var(--accent)); color: white; }
.ai-avatar-user { background: var(--border); color: var(--text); }
.ai-msg-content { flex: 1; min-width: 0; }
.ai-msg-bubble { padding: 12px 16px; border-radius: 12px; font-size: 14px; line-height: 1.6; position: relative; }
.ai-msg-assistant .ai-msg-bubble { background: var(--surface); border: 1px solid var(--border); border-top-left-radius: 4px; }
.ai-msg-assistant .ai-msg-bubble::before { content: ''; position: absolute; top: 12px; left: -7px; width: 0; height: 0; border-top: 6px solid transparent; border-bottom: 6px solid transparent; border-right: 7px solid var(--border); }
.ai-msg-assistant .ai-msg-bubble::after { content: ''; position: absolute; top: 12px; left: -6px; width: 0; height: 0; border-top: 6px solid transparent; border-bottom: 6px solid transparent; border-right: 7px solid var(--surface); }
.ai-msg-user .ai-msg-bubble { background: var(--primary); color: white; border-top-right-radius: 4px; }
.ai-msg-user .ai-msg-bubble::before { content: ''; position: absolute; top: 12px; right: -7px; width: 0; height: 0; border-top: 6px solid transparent; border-bottom: 6px solid transparent; border-left: 7px solid var(--primary); }
.ai-msg-text { margin-bottom: 0; }
.ai-msg-text strong { font-weight: 600; }
.ai-msg-meta { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.ai-msg-time { font-size: 11px; color: var(--text-muted); }
.ai-copy-btn { background: none; border: none; cursor: pointer; color: var(--text-muted); padding: 2px; opacity: 0; transition: opacity 0.15s ease; }
.ai-msg-bubble:hover .ai-copy-btn { opacity: 1; }
.ai-copy-btn:hover { color: var(--primary); }

/* AI data cards */
.ai-msg-cards { margin-top: 10px; }
.ai-data-card { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 12px; }
.ai-data-card h4 { font-size: 12px; font-weight: 600; color: var(--text-muted); margin-bottom: 4px; }
.ai-data-row { display: flex; justify-content: space-between; align-items: center; padding: 4px 0; font-size: 13px; gap: 8px; }
.ai-data-row span { color: var(--text-secondary); }
.ai-row-highlight { background: rgba(16,185,129,0.06); margin: 0 -8px; padding: 4px 8px; border-radius: 4px; }
.ai-row-danger { color: var(--error); }
.ai-row-danger strong { color: var(--error); }
.ai-progress-bar-wrap { margin-top: 8px; }
.ai-progress-bar { height: 6px; background: var(--border-light); border-radius: 3px; overflow: hidden; }
.ai-progress-fill { height: 100%; background: var(--primary); border-radius: 3px; transition: width 0.6s ease; }
.ai-progress-fill.over-budget { background: var(--error); }
.ai-progress-label { font-size: 11px; color: var(--text-muted); margin-top: 4px; display: block; }

/* AI mini tables */
.ai-mini-table { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.ai-table-header { display: flex; gap: 8px; padding: 8px 12px; background: var(--border-light); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); }
.ai-table-header span { flex: 1; }
.ai-table-row { display: flex; gap: 8px; padding: 8px 12px; font-size: 13px; border-bottom: 1px solid var(--border-light); }
.ai-table-row:last-child { border-bottom: none; }
.ai-table-row span { flex: 1; }
.ai-table-row .text-right { text-align: right; }

/* AI item chips */
.ai-item-chip { padding: 8px 12px; background: var(--bg); border: 1px solid var(--border); border-radius: 6px; font-size: 13px; margin-bottom: 4px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ai-item-chip:last-child { margin-bottom: 0; }
.ai-chip-danger { border-color: var(--error-light); background: rgba(239,68,68,0.04); }
.ai-chip-warning { border-color: var(--warning-light); background: rgba(245,158,11,0.04); }
.ai-trade-badge { font-size: 10px; padding: 1px 6px; border-radius: 99px; background: var(--success-light); color: var(--success-dark); font-weight: 600; }

/* AI bar chart */
.ai-bar-chart { display: flex; flex-direction: column; gap: 6px; }
.ai-bar-row { display: flex; align-items: center; gap: 10px; }
.ai-bar-label { width: 110px; font-size: 12px; font-weight: 500; text-align: right; flex-shrink: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-bar-track { flex: 1; height: 16px; background: var(--border-light); border-radius: 4px; overflow: hidden; }
.ai-bar-fill { height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent)); border-radius: 4px; }
.ai-bar-value { width: 80px; font-size: 12px; font-weight: 600; text-align: right; }

/* AI chart wrap */
.ai-chart-wrap { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 12px; overflow-x: auto; }

/* AI link cards */
.ai-link-card { margin-top: 8px; }
.ai-view-link { color: var(--primary); font-size: 13px; font-weight: 500; text-decoration: none; }
.ai-view-link:hover { text-decoration: underline; }

/* AI typing indicator */
.ai-typing { display: flex; gap: 10px; align-self: flex-start; }
.ai-typing-bubble { display: flex; gap: 4px; padding: 14px 18px; }
.ai-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--text-muted); animation: aiDotBounce 1.4s infinite ease-in-out; }
.ai-dot:nth-child(2) { animation-delay: 0.2s; }
.ai-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes aiDotBounce { 0%, 60%, 100% { transform: translateY(0); opacity: 0.4; } 30% { transform: translateY(-4px); opacity: 1; } }

/* AI suggestions */
.ai-suggestions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.ai-suggestion-chip { padding: 5px 12px; border: 1px solid var(--border); border-radius: 99px; font-size: 12px; font-family: inherit; cursor: pointer; background: var(--surface); color: var(--text-secondary); transition: all 0.2s ease; }
.ai-suggestion-chip:hover { border-color: var(--primary); color: var(--primary); background: rgba(99,102,241,0.04); }

/* AI input bar */
.ai-input-bar { display: flex; gap: 8px; padding-top: 10px; border-top: 1px solid var(--border-light); }
.ai-input-bar input { flex: 1; padding: 10px 14px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; font-family: inherit; }
.ai-input-bar input:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px rgba(99,102,241,0.12); }


/* ==========================================================================
   NEW: PRESENTATIONS — Production slide builder styles
   ========================================================================== */

.pres-header-actions { display: flex; gap: 8px; }

.pres-sorter { width: 180px; flex-shrink: 0; display: flex; flex-direction: column; gap: 4px; overflow-y: auto; max-height: calc(100vh - 200px); }
.pres-thumb { padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px; cursor: pointer; font-size: 12px; display: flex; align-items: center; gap: 6px; transition: all 0.15s ease; position: relative; }
.pres-thumb:hover { border-color: var(--primary); background: rgba(99,102,241,0.04); }
.pres-thumb.active { border-color: var(--primary); background: rgba(99,102,241,0.08); }
.pres-thumb.dragging { opacity: 0.5; }
.pres-thumb.drag-over { border-color: var(--accent); border-style: dashed; }
.pres-thumb-num { width: 20px; height: 20px; border-radius: 50%; background: var(--border-light); display: flex; align-items: center; justify-content: center; font-weight: 700; flex-shrink: 0; font-size: 11px; }
.pres-thumb.active .pres-thumb-num { background: var(--primary); color: white; }
.pres-thumb-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.pres-thumb-actions { display: none; gap: 2px; margin-left: auto; }
.pres-thumb:hover .pres-thumb-actions { display: flex; }
.pres-thumb-btn { background: none; border: none; cursor: pointer; padding: 2px; color: var(--text-muted); border-radius: 4px; }
.pres-thumb-btn:hover { background: var(--border-light); color: var(--text); }

.pres-preview-wrap { flex: 1; display: flex; flex-direction: column; gap: 12px; }
.pres-slide-container { flex: 1; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); display: flex; align-items: stretch; overflow: hidden; aspect-ratio: 16 / 9; }
.pres-slide-controls { display: flex; align-items: center; justify-content: center; gap: 16px; }
.pres-slide-indicator { font-size: 13px; color: var(--text-secondary); font-weight: 500; }

/* Slide base */
.slide { width: 100%; padding: 40px; display: flex; flex-direction: column; animation: fadeIn 0.3s ease both; overflow: hidden; }
.slide-dark { color: white; }
.slide-light { color: var(--text); }
.slide-heading { font-size: 20px; font-weight: 600; margin-bottom: 16px; }

/* Cover slide */
.slide-cover { align-items: center; justify-content: center; text-align: center; }
.slide-brand-row { display: flex; align-items: center; gap: 8px; margin-bottom: 24px; }
.slide-brand-name { font-weight: 600; font-size: 14px; opacity: 0.6; }
.slide-cover-title { font-family: 'Playfair Display', Georgia, serif; font-size: 36px; margin-bottom: 8px; cursor: default; }
.slide-cover-title.slide-editable { cursor: text; }
.slide-cover-title.editing { outline: 2px solid var(--primary); outline-offset: 4px; border-radius: 4px; }
.slide-cover-subtitle { font-size: 16px; opacity: 0.7; }
.slide-cover-address { font-size: 14px; opacity: 0.5; margin-top: 4px; }
.slide-cover-date { font-size: 12px; opacity: 0.4; margin-top: 8px; }

/* Mood board slide */
.slide-mood-grid { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 12px; }
.slide-mood-color { text-align: center; }
.slide-mood-swatch { width: 72px; height: 72px; border-radius: 8px; margin-bottom: 4px; border: 1px solid rgba(0,0,0,0.08); }
.slide-mood-color span { font-size: 11px; color: var(--text-secondary); }
.slide-mood-image { width: 120px; height: 120px; border-radius: 8px; overflow: hidden; }
.slide-mood-image img { width: 100%; height: 100%; object-fit: cover; }
.slide-mood-notes p { font-size: 13px; color: var(--text-secondary); font-style: italic; background: var(--bg); padding: 8px 12px; border-radius: 6px; }

/* Room spec slide */
.slide-spec-table { font-size: 13px; width: 100%; border-collapse: collapse; }
.slide-spec-table th { text-align: left; padding: 6px 8px; border-bottom: 2px solid var(--border); font-size: 10px; text-transform: uppercase; color: var(--text-muted); font-weight: 600; }
.slide-spec-table td { padding: 6px 8px; border-bottom: 1px solid var(--border-light); vertical-align: middle; }
.slide-th-image { width: 40px; }
.slide-item-thumb { width: 32px; height: 32px; background: var(--bg); border-radius: 4px; display: flex; align-items: center; justify-content: center; }

/* Budget slide */
.slide-budget-chart { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.slide-budget-row { display: flex; align-items: center; gap: 12px; }
.slide-budget-label { width: 120px; font-size: 13px; font-weight: 500; text-align: right; flex-shrink: 0; }
.slide-budget-bar-track { flex: 1; height: 18px; background: var(--border-light); border-radius: 4px; overflow: hidden; }
.slide-budget-bar-fill { height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent)); border-radius: 4px; }
.slide-budget-val { width: 80px; font-size: 13px; font-weight: 600; text-align: right; }
.slide-budget-totals { display: flex; gap: 24px; justify-content: center; border-top: 2px solid var(--border); padding-top: 12px; }
.slide-budget-total-item { text-align: center; }
.slide-budget-total-item span { display: block; font-size: 12px; color: var(--text-muted); }
.slide-budget-total-item strong { font-size: 16px; }
.slide-budget-total-item.over-budget strong { color: var(--error); }

/* Schedule slide */
.slide-schedule-timeline { margin: 16px 0; }
.slide-schedule-bar { display: flex; align-items: center; gap: 12px; }
.slide-schedule-date { font-size: 11px; color: var(--text-muted); white-space: nowrap; }
.slide-schedule-track { flex: 1; position: relative; height: 60px; background: var(--border-light); border-radius: 4px; }
.slide-schedule-marker { position: absolute; top: 0; bottom: 0; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.slide-schedule-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; margin-top: 8px; }
.slide-schedule-label { font-size: 9px; writing-mode: vertical-rl; text-orientation: mixed; transform: rotate(180deg); color: var(--text-secondary); max-height: 36px; overflow: hidden; }
.slide-schedule-legend { display: flex; gap: 16px; justify-content: center; margin-top: 12px; font-size: 12px; color: var(--text-secondary); }
.slide-legend-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; vertical-align: middle; }

/* Before/After slide */
.slide-ba-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; flex: 1; }
.slide-ba-panel { display: flex; flex-direction: column; }
.slide-ba-placeholder { flex: 1; background: var(--border-light); border-radius: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; color: var(--text-muted); min-height: 200px; }
.slide-ba-label { text-align: center; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); margin-top: 8px; }

/* Material palette slide */
.slide-palette-grid { display: flex; gap: 20px; flex-wrap: wrap; margin-bottom: 16px; }
.slide-palette-item { text-align: center; }
.slide-palette-swatch { width: 72px; height: 72px; border-radius: 10px; margin-bottom: 6px; border: 1px solid rgba(0,0,0,0.08); }
.slide-palette-name { display: block; font-size: 12px; font-weight: 500; }
.slide-palette-hex { display: block; font-size: 10px; color: var(--text-muted); font-family: monospace; }
.slide-palette-descriptions p { font-size: 13px; color: var(--text-secondary); font-style: italic; }

/* Thank you slide */
.slide-thankyou { align-items: center; justify-content: center; text-align: center; }
.slide-thankyou-content h1 { font-family: 'Playfair Display', Georgia, serif; font-size: 42px; margin-bottom: 8px; }
.slide-thankyou-sub { font-size: 16px; opacity: 0.7; }
.slide-thankyou-divider { width: 60px; height: 2px; background: rgba(255,255,255,0.2); margin: 20px auto; }
.slide-thankyou-contact { font-size: 14px; opacity: 0.6; line-height: 1.8; }
.slide-thankyou-contact strong { opacity: 1; font-size: 15px; }
.slide-thankyou-next { margin-top: 20px; text-align: left; max-width: 380px; }
.slide-thankyou-next h4 { font-size: 14px; opacity: 0.7; margin-bottom: 6px; }
.slide-thankyou-next ol { font-size: 13px; opacity: 0.5; padding-left: 18px; line-height: 1.8; }

/* Template picker modal */
.pres-modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.4); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.pres-modal { background: var(--surface); border-radius: var(--radius); width: 560px; max-width: 90vw; box-shadow: 0 20px 60px rgba(0,0,0,0.15); }
.pres-modal-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border-light); }
.pres-modal-header h3 { margin: 0; font-size: 16px; }
.pres-modal-close { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--text-muted); }
.pres-template-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 16px; }
.pres-template-btn { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 16px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); cursor: pointer; font-family: inherit; transition: all 0.15s ease; }
.pres-template-btn:hover { border-color: var(--primary); background: rgba(99,102,241,0.04); }
.pres-template-icon { font-size: 24px; }
.pres-template-desc { font-size: 11px; color: var(--text-muted); }

/* Fullscreen presentation */
.pres-fullscreen { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: #000; z-index: 9999; display: flex; align-items: center; justify-content: center; }
.pres-fullscreen-slide { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; transition: opacity 0.25s ease; }
.pres-fullscreen-slide .slide { max-width: 1200px; max-height: 100vh; margin: auto; }
.pres-fs-counter { position: fixed; bottom: 20px; right: 20px; color: rgba(255,255,255,0.5); font-size: 14px; font-weight: 500; z-index: 10000; }
.pres-fs-exit { position: fixed; top: 16px; right: 16px; background: rgba(255,255,255,0.15); border: none; color: white; font-size: 24px; width: 40px; height: 40px; border-radius: 50%; cursor: pointer; z-index: 10000; display: flex; align-items: center; justify-content: center; }
.pres-fs-exit:hover { background: rgba(255,255,255,0.3); }


/* ==========================================================================
   NEW: SETTINGS — Production settings page styles
   ========================================================================== */

.settings-layout { display: flex; gap: 24px; }
.settings-nav { width: 220px; flex-shrink: 0; display: flex; flex-direction: column; gap: 2px; position: sticky; top: calc(var(--topbar-h) + 24px); align-self: flex-start; }
.settings-nav-btn { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border: none; background: none; border-radius: 8px; font-size: 14px; font-family: inherit; cursor: pointer; color: var(--text-secondary); transition: all 0.15s ease; text-align: left; width: 100%; }
.settings-nav-btn:hover { background: var(--bg); color: var(--text); }
.settings-nav-btn.active { background: var(--primary-100, rgba(99,102,241,0.1)); color: var(--primary); font-weight: 500; }

.settings-panel { flex: 1; min-width: 0; }
.settings-section h2 { font-size: 20px; font-weight: 600; margin-bottom: 4px; }
.settings-desc { font-size: 14px; color: var(--text-secondary); margin-bottom: 20px; }
.settings-form { display: flex; flex-direction: column; gap: 16px; }
.settings-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.settings-form .form-group label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 4px; color: var(--text-secondary); }
.settings-form .form-group input,
.settings-form .form-group textarea { width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; font-family: inherit; transition: border-color 0.15s ease; }
.settings-form .form-group input:focus,
.settings-form .form-group textarea:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px rgba(99,102,241,0.12); }

/* Logo upload */
.settings-logo-row { display: flex; align-items: flex-start; gap: 16px; }
.settings-logo-preview { width: 120px; height: 80px; border: 1px dashed var(--border); border-radius: 8px; display: flex; align-items: center; justify-content: center; overflow: hidden; background: var(--bg); }
.settings-logo-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.settings-logo-placeholder { font-size: 12px; color: var(--text-muted); text-align: center; padding: 8px; }
.settings-logo-actions { display: flex; flex-direction: column; gap: 6px; }

/* Sliders */
.settings-slider-row { display: flex; align-items: center; gap: 12px; }
.settings-slider { flex: 1; -webkit-appearance: none; appearance: none; height: 6px; background: var(--border-light); border-radius: 3px; outline: none; }
.settings-slider::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%; background: var(--primary); cursor: pointer; box-shadow: 0 1px 4px rgba(0,0,0,0.15); }
.settings-slider-value { font-size: 16px; font-weight: 600; min-width: 48px; text-align: right; }
.settings-presets { display: flex; gap: 6px; margin-top: 4px; }
.settings-preset-btn { padding: 4px 12px; border: 1px solid var(--border); border-radius: 99px; font-size: 12px; font-family: inherit; cursor: pointer; background: var(--surface); color: var(--text-secondary); transition: all 0.15s ease; }
.settings-preset-btn:hover { border-color: var(--primary); color: var(--primary); }
.settings-preset-btn.active { background: var(--primary); color: white; border-color: var(--primary); }

/* Select */
.settings-select { width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; font-family: inherit; background: var(--surface); }
.settings-select:focus { border-color: var(--primary); outline: none; }

/* Preview card */
.settings-preview-card { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 16px; }
.settings-preview-card h4 { font-size: 14px; margin-bottom: 4px; }
.settings-preview-grid { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin-top: 8px; font-size: 13px; }
.settings-preview-total { font-size: 15px; padding-top: 6px; border-top: 1px solid var(--border); margin-top: 4px; }

/* Storage */
.settings-storage { margin-bottom: 20px; }
.settings-storage h4 { font-size: 14px; margin-bottom: 8px; }
.settings-storage-bar { height: 8px; background: var(--border-light); border-radius: 4px; overflow: hidden; margin-bottom: 4px; }
.settings-storage-fill { height: 100%; border-radius: 4px; transition: width 0.3s ease; }
.settings-storage-label { font-size: 12px; color: var(--text-muted); }

/* Data groups */
.settings-data-group { margin-bottom: 24px; }
.settings-data-group h4 { font-size: 15px; margin-bottom: 8px; }
.settings-data-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* Danger zone */
.settings-danger-zone { border: 1px solid var(--error-light); border-radius: 8px; padding: 16px; background: rgba(239,68,68,0.02); }
.settings-danger-item { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--error-light); }
.settings-danger-item:last-child { border-bottom: none; padding-bottom: 0; }
.settings-danger-item strong { font-size: 14px; }
.settings-danger-item p { font-size: 12px; }
.settings-danger-btn { color: var(--error); border-color: var(--error-light); flex-shrink: 0; }
.settings-danger-btn:hover { background: var(--error-light); }

/* Theme selector */
.settings-theme-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.settings-theme-btn { padding: 12px; border: 2px solid var(--border); border-radius: 10px; background: var(--surface); cursor: pointer; font-family: inherit; text-align: center; transition: all 0.15s ease; }
.settings-theme-btn:hover { border-color: var(--border-strong); }
.settings-theme-btn.active { border-color: var(--primary); }
.settings-theme-preview { width: 100%; height: 60px; border-radius: 6px; display: flex; overflow: hidden; margin-bottom: 8px; }
.settings-theme-light .theme-preview-sidebar { width: 25%; background: #f8fafc; }
.settings-theme-light .theme-preview-content { flex: 1; background: #ffffff; padding: 8px; }
.settings-theme-dark .theme-preview-sidebar { width: 25%; background: #1e293b; }
.settings-theme-dark .theme-preview-content { flex: 1; background: #0f172a; padding: 8px; }
.settings-theme-system .theme-preview-sidebar { width: 25%; background: linear-gradient(180deg, #f8fafc 50%, #1e293b 50%); }
.settings-theme-system .theme-preview-content { flex: 1; background: linear-gradient(180deg, #fff 50%, #0f172a 50%); padding: 8px; }
.theme-preview-bar { height: 6px; background: rgba(0,0,0,0.1); border-radius: 3px; margin-bottom: 6px; }
.theme-preview-body { height: 20px; background: rgba(0,0,0,0.05); border-radius: 4px; }
.settings-coming-soon { font-size: 10px; color: var(--text-muted); display: block; margin-top: 2px; }

/* Toggle switch */
.settings-toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.settings-toggle-row span { font-size: 14px; color: var(--text-secondary); }
.settings-toggle { position: relative; display: inline-block; width: 44px; height: 24px; cursor: pointer; }
.settings-toggle input { opacity: 0; width: 0; height: 0; }
.settings-toggle-slider { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: var(--border); border-radius: 12px; transition: 0.3s; }
.settings-toggle-slider::before { content: ''; position: absolute; width: 18px; height: 18px; border-radius: 50%; background: white; top: 3px; left: 3px; transition: 0.3s; }
.settings-toggle input:checked + .settings-toggle-slider { background: var(--primary); }
.settings-toggle input:checked + .settings-toggle-slider::before { transform: translateX(20px); }

/* Currency preview */
.settings-currency-preview { display: flex; gap: 16px; flex-wrap: wrap; }
.settings-currency-sample { font-size: 14px; }
.settings-currency-sample span { color: var(--text-muted); margin-right: 6px; }

/* Keyboard shortcuts */
.settings-shortcuts { display: flex; flex-direction: column; gap: 20px; }
.settings-shortcut-group h4 { font-size: 14px; font-weight: 600; margin-bottom: 8px; color: var(--text); }
.settings-shortcut-list { display: flex; flex-direction: column; gap: 6px; }
.settings-shortcut-row { display: flex; align-items: center; gap: 12px; padding: 6px 0; }
.settings-shortcut-keys { display: flex; align-items: center; gap: 4px; min-width: 140px; }
.settings-shortcut-keys kbd { background: var(--bg); border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 4px; padding: 2px 8px; font-size: 12px; font-family: inherit; font-weight: 600; color: var(--text-secondary); }
.settings-kbd-plus { font-size: 11px; color: var(--text-muted); }
.settings-shortcut-desc { font-size: 14px; color: var(--text-secondary); }

/* About */
.settings-about { display: flex; flex-direction: column; gap: 20px; }
.settings-about-logo { display: flex; align-items: center; gap: 16px; }
.settings-about-logo h3 { font-size: 18px; margin-bottom: 2px; }
.settings-about-info { display: flex; flex-direction: column; gap: 4px; }
.settings-about-row { display: flex; justify-content: space-between; padding: 6px 0; font-size: 14px; border-bottom: 1px solid var(--border-light); }
.settings-about-row span { color: var(--text-secondary); }
.settings-about-features h4 { font-size: 15px; margin-bottom: 8px; }
.settings-about-features ul { font-size: 14px; color: var(--text-secondary); padding-left: 20px; line-height: 1.8; }
.settings-about-credits { padding-top: 8px; border-top: 1px solid var(--border-light); }
.settings-about-link { color: var(--primary); font-size: 14px; text-decoration: none; display: inline-block; margin-top: 8px; }
.settings-about-link:hover { text-decoration: underline; }

/* Compact mode */
body.compact-mode .app-main { padding: 16px; }
body.compact-mode .portal-card { padding: 16px; }
body.compact-mode .settings-section { padding: 16px; }

/* Responsive for new views */
@media (max-width: 768px) {
  .portal-grid-2, .portal-grid-3 { grid-template-columns: 1fr; }
  .portal-selection-grid { grid-template-columns: 1fr; }
  .portal-hero { padding: 32px 20px 28px; }
  .portal-project-name { font-size: 28px; }
  .settings-layout { flex-direction: column; }
  .settings-nav { width: 100%; flex-direction: row; overflow-x: auto; position: static; }
  .settings-nav-btn span { display: none; }
  .settings-form-grid { grid-template-columns: 1fr; }
  .settings-theme-grid { grid-template-columns: 1fr 1fr; }
  .pres-sorter { width: 100%; flex-direction: row; overflow-x: auto; max-height: none; }
  .ai-msg { max-width: 92%; }
}


/* ==========================================================================
   PROCUREMENT — PRODUCTION ENHANCEMENTS
   ========================================================================== */

.view-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.view-type-toggle {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 8px);
  overflow: hidden;
}
.view-type-toggle .toggle-btn {
  padding: 6px 10px;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  transition: all .15s;
}
.view-type-toggle .toggle-btn.active {
  background: var(--primary);
  color: white;
}
.view-type-toggle .toggle-btn:hover:not(.active) {
  background: var(--bg);
}

.pipeline-stage {
  cursor: pointer;
  padding: 6px 10px;
  border-radius: var(--radius-sm, 8px);
  transition: all .15s;
}
.pipeline-stage:hover { background: var(--bg); }
.pipeline-stage.pipeline-active { background: rgba(99,102,241,.08); }
.pipeline-value { font-size: 10px; color: var(--text-muted); display: block; margin-top: 2px; }

.financial-summary-sticky {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius, 12px);
  padding: 12px 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.margin-warnings {
  font-size: 12px;
  padding: 6px 0 0;
  color: var(--text-secondary);
}
.text-warning { color: var(--warning); font-weight: 600; }
.breakdown-toggles {
  display: flex;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border-light, #f1f5f9);
  margin-top: 8px;
}
.breakdown-panel { margin-top: 8px; padding: 8px 0; }
.breakdown-table { width: 100%; font-size: 12px; border-collapse: collapse; }
.breakdown-table th {
  text-align: left; padding: 4px 8px; font-weight: 600;
  color: var(--text-muted); font-size: 10px; text-transform: uppercase;
  border-bottom: 1px solid var(--border);
}
.breakdown-table td { padding: 4px 8px; border-bottom: 1px solid var(--border-light, #f1f5f9); }

.search-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.search-input-wrap svg {
  position: absolute; left: 10px; width: 16px; height: 16px;
  color: var(--text-muted); pointer-events: none;
}
.search-input {
  padding: 7px 10px 7px 32px; border: 1px solid var(--border);
  border-radius: var(--radius-sm, 8px); font-size: 13px; font-family: inherit;
  color: var(--text); background: var(--bg); width: 220px; transition: border-color .15s;
}
.search-input:focus { outline: none; border-color: var(--primary); }

.table-controls-left { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.table-controls-right { display: flex; align-items: center; gap: 12px; }
.text-sm { font-size: 12px; }
.text-xs { font-size: 11px; }

.column-toggle-wrap { position: relative; }
.column-toggle-dropdown {
  position: absolute; top: 100%; right: 0; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-sm, 8px);
  padding: 8px; box-shadow: var(--shadow-lg); z-index: 20; min-width: 160px;
}
.column-toggle-dropdown .checkbox-item { padding: 4px 0; font-size: 12px; }

.resizable-th { position: relative; }
.th-content { display: flex; align-items: center; gap: 4px; }
.col-resizer {
  position: absolute; right: 0; top: 0; bottom: 0; width: 4px;
  cursor: col-resize; background: transparent;
}
.col-resizer:hover { background: var(--primary); }

.cell-editable { cursor: default; }
.cell-editable:hover { background: var(--bg); }
.inline-edit-input, .inline-edit-select {
  width: 100%; padding: 4px 6px; border: 2px solid var(--primary);
  border-radius: 4px; font-size: 13px; font-family: inherit; background: white; outline: none;
}

.data-row { transition: background .1s; }
.data-row:hover { background: var(--bg); }
.row-selected { background: rgba(99,102,241,.06) !important; }
.row-low-margin td.text-warning { font-weight: 600; }
.row-overdue { background: rgba(239,68,68,.04); }
.row-overdue:hover { background: rgba(239,68,68,.08); }
.td-checkbox, .th-checkbox { width: 40px; text-align: center; }

.expanded-row td { padding: 0 !important; background: var(--bg); }
.expanded-detail { padding: 16px 20px; border-top: 2px solid var(--primary); }
.expanded-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px;
}
.expanded-section h4 {
  font-size: 12px; text-transform: uppercase; color: var(--text-muted);
  margin-bottom: 8px; letter-spacing: .05em;
}
.detail-row { font-size: 13px; padding: 3px 0; }
.detail-row .text-muted { margin-right: 6px; }

.delivery-timeline { display: flex; align-items: center; gap: 0; flex-wrap: wrap; }
.timeline-step { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.timeline-dot {
  width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--border);
}
.timeline-done .timeline-dot { border: none; }
.timeline-label { font-size: 10px; text-transform: capitalize; color: var(--text-muted); }
.timeline-done .timeline-label { color: var(--text); font-weight: 500; }
.timeline-connector {
  width: 20px; height: 2px; background: var(--border);
  margin: 0 2px; align-self: flex-start; margin-top: 6px;
}

.price-history-list { font-size: 12px; }
.price-history-item { padding: 4px 0; border-bottom: 1px solid var(--border-light, #f1f5f9); }

.image-upload-area {
  border: 2px dashed var(--border); border-radius: var(--radius-sm, 8px);
  padding: 24px; text-align: center; cursor: pointer; transition: all .15s;
  min-height: 80px; display: flex; align-items: center; justify-content: center;
}
.image-upload-area:hover, .image-upload-area.drag-active {
  border-color: var(--primary); background: rgba(99,102,241,.04);
}
.image-preview {
  max-width: 200px; max-height: 120px; border-radius: var(--radius-sm, 8px); object-fit: cover;
}
.item-image-preview { margin-top: 8px; }
.item-image-preview img {
  max-width: 160px; max-height: 100px; border-radius: var(--radius-sm, 8px); object-fit: cover;
}

.bulk-actions-bar {
  display: flex; align-items: center; gap: 8px; padding: 10px 16px;
  background: var(--primary); color: white; border-radius: var(--radius-sm, 8px);
  margin-bottom: 12px; font-size: 13px; font-weight: 500;
}
.bulk-actions-bar .btn-outline { color: white; border-color: rgba(255,255,255,.4); }
.bulk-actions-bar .btn-outline:hover { background: rgba(255,255,255,.15); }
.bulk-actions-bar .text-error { color: #fca5a5 !important; border-color: #fca5a5 !important; }

.pagination-bar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 0; margin-top: 8px;
}
.pagination-controls { display: flex; align-items: center; gap: 4px; }
.page-num.active { background: var(--primary); color: white; }
.pagination-ellipsis { padding: 0 4px; color: var(--text-muted); }

.btn-xs { padding: 4px 8px; font-size: 12px; border-radius: 6px; }
.btn-ghost {
  background: none; border: none; cursor: pointer; color: var(--text-secondary);
  font-family: inherit; display: inline-flex; align-items: center; gap: 4px; transition: color .15s;
}
.btn-ghost:hover { color: var(--primary); }
.btn-ghost.active { color: var(--primary); font-weight: 600; }
.btn-ghost:disabled { opacity: .4; cursor: not-allowed; }

.toast-undo-btn {
  background: none; border: 1px solid rgba(255,255,255,.4); color: white;
  padding: 2px 10px; border-radius: 4px; cursor: pointer; font-size: 12px; margin-left: 8px;
}
.toast-undo-btn:hover { background: rgba(255,255,255,.15); }

.typeahead-wrap { position: relative; }
.typeahead-dropdown {
  position: absolute; top: 100%; left: 0; right: 0; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-sm, 8px);
  box-shadow: var(--shadow-lg); z-index: 20; max-height: 200px; overflow-y: auto;
}
.typeahead-option { padding: 8px 12px; cursor: pointer; font-size: 13px; }
.typeahead-option:hover { background: var(--bg); }

.form-error { display: block; color: var(--error); font-size: 11px; min-height: 16px; }
.required { color: var(--error); }
.duplicate-btn svg { opacity: .5; }
.duplicate-btn:hover svg { opacity: 1; }

/* KANBAN BOARD */

.kanban-board {
  display: flex; gap: 12px; overflow-x: auto; padding-bottom: 16px; min-height: 400px;
}
.kanban-column { min-width: 220px; max-width: 260px; flex: 1; display: flex; flex-direction: column; }
.kanban-column-header {
  padding: 10px 12px; background: var(--surface); border-radius: var(--radius-sm, 8px);
  margin-bottom: 8px; box-shadow: var(--shadow);
}
.kanban-col-title { display: flex; align-items: center; gap: 8px; }
.kanban-col-name { font-weight: 600; font-size: 13px; text-transform: capitalize; }
.kanban-col-count {
  background: var(--bg); padding: 1px 7px; border-radius: 10px;
  font-size: 11px; font-weight: 700;
}
.kanban-col-value { font-size: 11px; color: var(--text-muted); margin-top: 4px; display: block; }
.kanban-cards {
  flex: 1; display: flex; flex-direction: column; gap: 6px; min-height: 60px;
  padding: 4px; border-radius: var(--radius-sm, 8px); transition: background .15s;
}
.kanban-cards.drag-over { background: rgba(99,102,241,.06); border: 2px dashed var(--primary); }
.kanban-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm, 8px); padding: 10px 12px;
  cursor: grab; transition: box-shadow .15s, transform .1s;
}
.kanban-card:hover { box-shadow: var(--shadow); }
.kanban-card.dragging { opacity: .5; transform: rotate(2deg); }
.kanban-card-name { font-weight: 600; font-size: 13px; margin-bottom: 2px; }
.kanban-card-supplier { font-size: 11px; margin-bottom: 6px; }
.kanban-card-meta {
  display: flex; justify-content: space-between; align-items: center; font-size: 12px;
}
.kanban-empty {
  padding: 20px; text-align: center; color: var(--text-muted); font-size: 12px;
  border: 2px dashed var(--border-light, #f1f5f9); border-radius: var(--radius-sm, 8px);
}

/* INVOICING — PRODUCTION ENHANCEMENTS */

.invoice-tabs {
  display: flex; gap: 4px; border-bottom: 2px solid var(--border-light, #f1f5f9);
  margin-bottom: 16px; overflow-x: auto;
}
.tab-btn {
  padding: 8px 16px; border: none; background: none; cursor: pointer;
  font-size: 13px; font-weight: 500; font-family: inherit; color: var(--text-secondary);
  border-bottom: 2px solid transparent; margin-bottom: -2px;
  transition: all .15s; white-space: nowrap; display: flex; align-items: center; gap: 6px;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-count {
  background: var(--bg); padding: 1px 6px; border-radius: 10px;
  font-size: 10px; font-weight: 700;
}
.tab-btn.active .tab-count { background: var(--primary); color: white; }

.overdue-badge {
  display: inline-block; font-size: 10px; font-weight: 600;
  color: var(--error); background: rgba(239,68,68,.1);
  padding: 1px 6px; border-radius: 4px; margin-left: 4px;
}

.footer-totals td {
  border-top: 2px solid var(--border) !important; font-size: 13px; padding-top: 10px !important;
}

.invoice-brand-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 28px; padding-bottom: 20px; border-bottom: 3px solid var(--text);
}
.invoice-brand-left { display: flex; align-items: flex-start; gap: 16px; }
.invoice-logo-placeholder {
  width: 56px; height: 56px;
  background: linear-gradient(135deg, var(--primary), var(--accent, #a855f7));
  color: white; display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm, 8px); font-weight: 800; font-size: 20px; flex-shrink: 0;
}
.invoice-company-name { font-size: 18px; margin-bottom: 4px; }
.invoice-title-block { text-align: right; }
.invoice-title {
  font-size: 28px; font-weight: 800; text-transform: uppercase;
  letter-spacing: .05em; color: var(--text);
}
.invoice-number { font-size: 16px; color: var(--text-muted); margin-top: 4px; }

.invoice-parties {
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 24px; margin-bottom: 24px;
}
.invoice-from, .invoice-to, .invoice-dates { font-size: 13px; line-height: 1.7; }
.invoice-dates { text-align: right; }
.invoice-dates > div { padding: 2px 0; }

.invoice-detail { position: relative; overflow: hidden; }
.paid-watermark {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%) rotate(-30deg);
  font-size: 100px; font-weight: 900; color: rgba(16,185,129,.08);
  pointer-events: none; z-index: 1; text-transform: uppercase; letter-spacing: .1em;
}
.credit-note-watermark {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%) rotate(-30deg);
  font-size: 64px; font-weight: 900; color: rgba(168,85,247,.08);
  pointer-events: none; z-index: 1; text-transform: uppercase; letter-spacing: .1em;
}

.progress-payment-banner {
  background: rgba(99,102,241,.06); border: 1px solid rgba(99,102,241,.15);
  border-radius: var(--radius-sm, 8px); padding: 8px 16px;
  font-size: 13px; font-weight: 500; color: var(--primary); margin-bottom: 16px;
}

.invoice-notes, .invoice-terms {
  margin-top: 16px; padding: 12px 16px; background: var(--bg);
  border-radius: var(--radius-sm, 8px); font-size: 13px; line-height: 1.6;
}
.invoice-notes h4, .invoice-terms h4 {
  font-size: 12px; text-transform: uppercase; color: var(--text-muted); margin-bottom: 6px;
}

.invoice-payment-details {
  margin-top: 20px; padding: 16px; border: 1px solid var(--border);
  border-radius: var(--radius-sm, 8px);
}
.invoice-payment-details h4 {
  font-size: 12px; text-transform: uppercase; color: var(--text-muted); margin-bottom: 10px;
}
.payment-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; font-size: 13px; }

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

.view-toggle {
  display: flex; border: 1px solid var(--border);
  border-radius: var(--radius-sm, 8px); overflow: hidden;
}
.view-toggle .toggle-btn {
  padding: 6px 12px; border: none; background: none; cursor: pointer;
  font-size: 13px; font-family: inherit; color: var(--text-secondary);
  display: flex; align-items: center; gap: 4px; transition: all .15s;
}
.view-toggle .toggle-btn.active { background: var(--primary); color: white; }
.view-toggle .toggle-btn:hover:not(.active) { background: var(--bg); }

/* REPORTING CHARTS */

.reports-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 20px;
}
.report-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius, 12px); padding: 20px; box-shadow: var(--shadow);
}
.report-card h3 {
  font-size: 14px; font-weight: 600; margin-bottom: 16px;
  color: var(--text-secondary); text-transform: uppercase; letter-spacing: .03em;
}

.chart-bar-container {
  display: flex; align-items: flex-end; gap: 6px; height: 200px; padding-top: 20px;
}
.chart-bar-col {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: flex-end; gap: 4px; height: 100%;
}
.chart-bar {
  width: 100%; max-width: 40px; border-radius: 4px 4px 0 0;
  transition: height .3s ease; min-height: 4px;
}
.chart-bar-label {
  font-size: 9px; color: var(--text-muted); white-space: nowrap;
  transform: rotate(-45deg); transform-origin: top center; margin-top: 4px;
}

.aging-grid { display: flex; flex-direction: column; gap: 10px; }
.aging-row { display: flex; align-items: center; gap: 10px; }
.aging-label { font-size: 12px; font-weight: 500; min-width: 70px; color: var(--text-secondary); }
.aging-bar-wrap { flex: 1; height: 20px; background: var(--bg); border-radius: 4px; overflow: hidden; }
.aging-bar { height: 100%; border-radius: 4px; transition: width .3s ease; }
.aging-amount { font-size: 12px; font-weight: 600; min-width: 80px; text-align: right; }
.aging-total {
  margin-top: 12px; padding-top: 10px;
  border-top: 1px solid var(--border-light, #f1f5f9); font-size: 13px;
}

.clients-list { display: flex; flex-direction: column; gap: 8px; }
.client-row { display: flex; align-items: center; gap: 8px; }
.client-rank { font-size: 11px; font-weight: 700; color: var(--text-muted); min-width: 20px; }
.client-name { font-size: 12px; font-weight: 500; min-width: 120px; }
.client-bar-wrap { flex: 1; height: 16px; background: var(--bg); border-radius: 3px; overflow: hidden; }
.client-bar { height: 100%; background: var(--primary); border-radius: 3px; transition: width .3s ease; }
.client-amount { font-size: 12px; font-weight: 600; min-width: 80px; text-align: right; }

.summary-stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.summary-stat { display: flex; flex-direction: column; gap: 4px; }
.summary-stat .text-muted { font-size: 11px; }
.summary-stat strong { font-size: 20px; }

/* WIZARD */

.wizard-step { min-height: 280px; }
.wizard-progress {
  display: flex; align-items: center; justify-content: center; gap: 0; margin-bottom: 20px;
}
.wizard-dot {
  width: 28px; height: 28px; border-radius: 50%; background: var(--bg);
  border: 2px solid var(--border); display: flex; align-items: center;
  justify-content: center; font-size: 12px; font-weight: 700; color: var(--text-muted);
}
.wizard-dot.active { background: var(--primary); color: white; border-color: var(--primary); }
.wizard-dot.done { background: var(--success); color: white; border-color: var(--success); }
.wizard-line { width: 40px; height: 2px; background: var(--border); }
.wizard-line.done { background: var(--success); }

.wizard-running-total {
  background: var(--bg); padding: 10px 16px;
  border-radius: var(--radius-sm, 8px); margin-bottom: 12px; font-size: 13px;
}

.checkbox-item-detail { display: flex; flex-direction: column; gap: 0; }
.checkbox-item-detail strong { font-size: 13px; }
.checkbox-item-detail .text-muted { font-size: 11px; }

.custom-item-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.custom-desc {
  flex: 2; padding: 6px 10px; border: 1px solid var(--border);
  border-radius: 6px; font-size: 13px; font-family: inherit;
}
.custom-amount {
  flex: 1; padding: 6px 10px; border: 1px solid var(--border);
  border-radius: 6px; font-size: 13px; font-family: inherit;
}

.wizard-preview { background: var(--bg); border-radius: var(--radius-sm, 8px); padding: 16px; }
.preview-row { display: flex; justify-content: space-between; padding: 4px 0; font-size: 13px; }
.preview-total { font-size: 15px; padding: 8px 0; }
.preview-items { padding: 8px 0; }
.preview-item { display: flex; justify-content: space-between; padding: 3px 0; font-size: 12px; }

/* INVOICE PRINT ENHANCEMENT */

@media print {
  .no-print { display: none !important; }
  .invoice-detail {
    box-shadow: none !important; border: none !important;
    padding: 0 !important; margin: 0 !important; max-width: 100% !important;
  }
  .invoice-brand-header { border-bottom: 3px solid #000 !important; }
  .paid-watermark { color: rgba(16,185,129,.12) !important; }
  .credit-note-watermark { color: rgba(168,85,247,.12) !important; }
  .invoice-logo-placeholder, .status-badge {
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
  }
  .invoice-payment-details { border: 1px solid #ccc !important; }
}


/* ==========================================================================
   34. AUTHENTICATION
   ========================================================================== */

/* ── Auth mode: hide sidebar/topbar ──────────────────────────────────── */

.app-layout.auth-mode {
  grid-template-columns: 1fr;
  grid-template-rows: 1fr;
}
.app-layout.auth-mode .app-sidebar,
.app-layout.auth-mode .app-topbar {
  display: none !important;
}
.app-layout.auth-mode .app-content {
  grid-column: 1;
}
.app-layout.auth-mode .app-main {
  padding: 0;
  overflow-y: auto;
}

/* ── Container ───────────────────────────────────────────────────────── */

.auth-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  position: relative;
  background: var(--bg);
  overflow: hidden;
}

.auth-bg-pattern {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(99, 102, 241, 0.06) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(168, 85, 247, 0.06) 0%, transparent 60%),
    radial-gradient(ellipse at 50% 80%, rgba(99, 102, 241, 0.04) 0%, transparent 50%);
  pointer-events: none;
}

/* ── Card ─────────────────────────────────────────────────────────────── */

.auth-card {
  position: relative;
  width: 100%;
  max-width: 440px;
  background: var(--surface);
  border-radius: 16px;
  box-shadow:
    0 1px 3px rgba(0, 0, 0, 0.04),
    0 6px 24px rgba(0, 0, 0, 0.06),
    0 20px 60px rgba(0, 0, 0, 0.04);
  overflow: hidden;
  animation: authCardIn 0.4s ease-out;
}

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

.auth-card-gradient {
  height: 4px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
}

.auth-card-body {
  padding: 36px 32px 24px;
}

.auth-card-footer {
  padding: 16px 32px;
  border-top: 1px solid var(--border-light);
  background: var(--bg);
  text-align: center;
}

/* ── Header ──────────────────────────────────────────────────────────── */

.auth-header {
  text-align: center;
  margin-bottom: 24px;
}

.auth-logo {
  display: inline-flex;
  margin-bottom: 16px;
}

.auth-title {
  font-family: 'Playfair Display', serif;
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 6px;
  line-height: 1.3;
}

.auth-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.5;
}

/* ── Demo banner ─────────────────────────────────────────────────────── */

.auth-demo-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--primary-50);
  border: 1px solid var(--primary-100);
  border-radius: 10px;
  font-size: 12.5px;
  color: var(--text-secondary);
  margin-bottom: 20px;
}
.auth-demo-banner strong {
  color: var(--text);
  font-weight: 600;
}
.auth-demo-icon {
  display: flex;
  color: var(--primary);
}

/* ── Form layout ─────────────────────────────────────────────────────── */

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-description {
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0 0 4px;
}

/* ── Field ────────────────────────────────────────────────────────────── */

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.auth-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.auth-optional {
  font-weight: 400;
  color: var(--text-muted);
  font-size: 12px;
}

.auth-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.auth-input-icon {
  position: absolute;
  left: 12px;
  display: flex;
  color: var(--text-muted);
  pointer-events: none;
  transition: color 0.2s ease;
}

.auth-input {
  width: 100%;
  padding: 10px 12px 10px 40px;
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  color: var(--text);
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

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

.auth-input:hover {
  border-color: var(--border-strong);
}

.auth-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-100);
  background: var(--surface);
}

.auth-input:focus ~ .auth-input-icon,
.auth-input:focus + .auth-input-icon {
  color: var(--primary);
}

/* Focus on the parent wrap icon */
.auth-input-wrap:focus-within .auth-input-icon {
  color: var(--primary);
}

/* Error state */
.auth-field-has-error .auth-input {
  border-color: var(--error);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.08);
}
.auth-field-has-error .auth-input-icon {
  color: var(--error);
}

.auth-field-error {
  font-size: 12px;
  color: var(--error);
  line-height: 1.4;
  animation: authFieldErrorIn 0.2s ease-out;
}

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

.auth-form-error {
  padding: 10px 14px;
  background: var(--error-light);
  border: 1px solid rgba(239, 68, 68, 0.15);
  border-radius: 10px;
  font-size: 13px;
  color: var(--error-dark);
  animation: authFieldErrorIn 0.2s ease-out;
}

/* ── Password toggle ─────────────────────────────────────────────────── */

.auth-toggle-pw {
  position: absolute;
  right: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 6px;
  transition: color 0.2s ease, background 0.2s ease;
}
.auth-toggle-pw:hover {
  color: var(--text-secondary);
  background: var(--primary-50);
}

/* ── Password strength ───────────────────────────────────────────────── */

.auth-pw-strength {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: -8px;
}

.auth-pw-strength-bar {
  flex: 1;
  height: 4px;
  background: var(--border-light);
  border-radius: 2px;
  overflow: hidden;
}

.auth-pw-strength-fill {
  height: 100%;
  width: 0;
  border-radius: 2px;
  transition: width 0.3s ease, background-color 0.3s ease;
}

.auth-pw-strength-label {
  font-size: 11px;
  font-weight: 600;
  min-width: 40px;
  text-align: right;
}

/* ── Checkbox ─────────────────────────────────────────────────────────── */

.auth-checkbox {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.auth-checkbox input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.auth-checkbox-mark {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--border-strong);
  border-radius: 5px;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  margin-top: 1px;
}

.auth-checkbox input:checked + .auth-checkbox-mark {
  background: var(--primary);
  border-color: var(--primary);
}

.auth-checkbox input:checked + .auth-checkbox-mark::after {
  content: '';
  display: block;
  width: 10px;
  height: 6px;
  border-left: 2px solid white;
  border-bottom: 2px solid white;
  transform: rotate(-45deg) translateY(-1px);
}

.auth-checkbox input:focus-visible + .auth-checkbox-mark {
  box-shadow: 0 0 0 3px var(--primary-100);
}

.auth-checkbox-error .auth-checkbox-mark {
  border-color: var(--error);
}

.auth-terms-checkbox {
  margin-top: -4px;
}

/* ── Row layout ──────────────────────────────────────────────────────── */

.auth-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.auth-row-between {
  justify-content: space-between;
}

/* ── Submit button ───────────────────────────────────────────────────── */

.auth-submit {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  color: white;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.25);
  margin-top: 4px;
}

.auth-submit:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--primary-light), var(--primary));
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.35);
  transform: translateY(-1px);
}

.auth-submit:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 1px 4px rgba(99, 102, 241, 0.2);
}

.auth-submit:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
}

/* ── Spinner ──────────────────────────────────────────────────────────── */

.auth-spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: authSpin 0.7s linear infinite;
}

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

/* ── Divider ──────────────────────────────────────────────────────────── */

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.auth-divider span {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ── Social buttons ──────────────────────────────────────────────────── */

.auth-social-row {
  display: flex;
  gap: 12px;
}

.auth-social-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  color: var(--text);
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.auth-social-btn:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.auth-social-btn:active {
  background: var(--surface-pressed);
  transform: translateY(0.5px);
}

.auth-social-btn svg {
  flex-shrink: 0;
}

/* ── Links ────────────────────────────────────────────────────────────── */

.auth-link {
  color: var(--primary);
  font-weight: 500;
  font-size: 13px;
  text-decoration: none;
  transition: color 0.2s ease;
}

.auth-link:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

.auth-footer-text {
  text-align: center;
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 20px;
}

.auth-back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.auth-back-site {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s ease;
}

.auth-back-site:hover {
  color: var(--text-secondary);
}

/* ── Success state (forgot password confirmation) ────────────────────── */

.auth-success-state {
  text-align: center;
  padding: 8px 0;
}

.auth-success-icon {
  margin-bottom: 16px;
  animation: authSuccessPop 0.4s ease-out;
}

@keyframes authSuccessPop {
  0% { transform: scale(0.5); opacity: 0; }
  70% { transform: scale(1.1); }
  100% { transform: scale(1); opacity: 1; }
}

.auth-success-title {
  font-family: 'Playfair Display', serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 10px;
}

.auth-success-text {
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0 0 8px;
}

.auth-success-hint {
  font-size: 12.5px;
  color: var(--text-muted);
}

/* ── Sidebar user info ───────────────────────────────────────────────── */

.sidebar-user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--primary-50);
  margin-bottom: 8px;
}

.sidebar-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-user-details {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 1px;
}

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

.sidebar-user-plan {
  font-size: 11px;
  color: var(--text-muted);
}

.sidebar-upgrade-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  font-size: 12px;
  font-weight: 600;
  color: white;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border: none;
  border-radius: 8px;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 8px;
}

.sidebar-upgrade-btn:hover {
  box-shadow: 0 2px 12px rgba(99, 102, 241, 0.3);
  transform: translateY(-1px);
}

/* ── Avatar dropdown enhancements ────────────────────────────────────── */

.avatar-menu-user {
  padding: 12px 14px 10px;
}

.avatar-menu-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.avatar-menu-email {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.avatar-plan-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.5px;
}

.avatar-plan-pro {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
}

.avatar-plan-free {
  background: var(--border-light);
  color: var(--text-muted);
}

.avatar-menu-logout {
  color: var(--error) !important;
}
.avatar-menu-logout:hover {
  background: var(--error-light) !important;
}

/* ── Responsive: auth ────────────────────────────────────────────────── */

@media (max-width: 480px) {
  .auth-container {
    padding: 12px;
    align-items: flex-start;
    padding-top: 40px;
  }

  .auth-card {
    max-width: 100%;
    border-radius: 12px;
  }

  .auth-card-body {
    padding: 28px 20px 20px;
  }

  .auth-card-footer {
    padding: 12px 20px;
  }

  .auth-title {
    font-size: 22px;
  }

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

  .auth-social-btn {
    width: 100%;
  }
}

@media (max-width: 360px) {
  .auth-card-body {
    padding: 24px 16px 16px;
  }

  .auth-card-footer {
    padding: 10px 16px;
  }
}


/* ==========================================================================
   35. ONBOARDING WIZARD
   ========================================================================== */

.onboarding-container {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 60px);
  padding: 24px;
  overflow: hidden;
}

.onboarding-bg-decor {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 30%, rgba(99, 102, 241, 0.06) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 70%, rgba(168, 85, 247, 0.06) 0%, transparent 60%);
  pointer-events: none;
}

.onboarding-wrapper {
  position: relative;
  width: 100%;
  max-width: 600px;
  background: var(--surface);
  border-radius: 20px;
  box-shadow:
    0 1px 3px rgba(0, 0, 0, 0.04),
    0 8px 32px rgba(0, 0, 0, 0.06),
    0 24px 64px rgba(0, 0, 0, 0.04);
  animation: onboardingFadeIn 0.5s ease-out;
  overflow: hidden;
}

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

/* ── Header ──────────────────────────────────────────────────────────── */

.onboarding-header {
  padding: 20px 28px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.onboarding-logo-text {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  font-family: 'Inter', sans-serif;
}

/* ── Progress bar ────────────────────────────────────────────────────── */

.onboarding-progress {
  height: 4px;
  background: var(--border-light);
  margin: 16px 28px 0;
  border-radius: 2px;
  overflow: hidden;
}

.onboarding-progress-bar {
  height: 100%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 2px;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Step indicator dots ─────────────────────────────────────────────── */

.onboarding-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 28px 4px;
  gap: 0;
}

.onboarding-step-dot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.onboarding-dot-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  border: 2px solid var(--border);
  color: var(--text-muted);
  background: var(--surface);
  transition: all 0.3s ease;
}

.onboarding-step-dot.active .onboarding-dot-circle {
  border-color: var(--primary);
  color: white;
  background: var(--primary);
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.onboarding-step-dot.done .onboarding-dot-circle {
  border-color: var(--success);
  color: white;
  background: var(--success);
}

.onboarding-dot-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
}

.onboarding-step-dot.active .onboarding-dot-label {
  color: var(--primary);
  font-weight: 600;
}

.onboarding-step-dot.done .onboarding-dot-label {
  color: var(--success);
}

.onboarding-step-line {
  width: 40px;
  height: 2px;
  background: var(--border);
  margin: 0 4px;
  margin-bottom: 22px;
  transition: background 0.3s ease;
}

.onboarding-step-line.done {
  background: var(--success);
}

/* ── Step viewport & animations ──────────────────────────────────────── */

.onboarding-step-viewport {
  padding: 8px 28px;
  min-height: 320px;
  overflow: hidden;
}

.onboarding-step {
  animation-duration: 0.35s;
  animation-timing-function: ease-out;
  animation-fill-mode: both;
}

.onboarding-step-enter-right {
  animation-name: slideInRight;
}

.onboarding-step-enter-left {
  animation-name: slideInLeft;
}

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

@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-30px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ── Step inner content ──────────────────────────────────────────────── */

.onboarding-step-inner {
  padding: 8px 0 4px;
}

.onboarding-title {
  font-family: 'Playfair Display', serif;
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 8px;
  text-align: center;
}

.onboarding-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 0 0 24px;
  text-align: center;
  line-height: 1.5;
}

/* ── Welcome step ────────────────────────────────────────────────────── */

.onboarding-welcome {
  text-align: center;
}

.onboarding-welcome-icon {
  margin: 8px auto 20px;
  animation: welcomeBounce 0.6s ease-out;
}

@keyframes welcomeBounce {
  0% { transform: scale(0.5); opacity: 0; }
  60% { transform: scale(1.08); }
  100% { transform: scale(1); opacity: 1; }
}

/* ── Logo upload ─────────────────────────────────────────────────────── */

.onboarding-logo-upload {
  max-width: 240px;
  margin: 0 auto 12px;
  cursor: pointer;
  border-radius: 16px;
  border: 2px dashed var(--border);
  transition: all 0.2s ease;
  overflow: hidden;
}

.onboarding-logo-upload:hover,
.onboarding-logo-upload.drag-over {
  border-color: var(--primary);
  background: var(--primary-50);
}

.onboarding-logo-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 32px 16px;
  color: var(--text-muted);
  font-size: 13px;
}

.onboarding-logo-placeholder svg {
  opacity: 0.5;
}

.onboarding-logo-preview {
  display: block;
  width: 100%;
  max-height: 120px;
  object-fit: contain;
  padding: 16px;
}

/* ── Form styles ─────────────────────────────────────────────────────── */

.onboarding-form {
  text-align: left;
}

.onboarding-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.onboarding-form .form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.onboarding-form .form-group label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
}

.onboarding-form .form-group .required {
  color: var(--error);
}

.onboarding-form input,
.onboarding-form select {
  padding: 9px 12px;
  font-size: 13.5px;
  font-family: 'Inter', sans-serif;
  color: var(--text);
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  width: 100%;
  box-sizing: border-box;
}

.onboarding-form input:focus,
.onboarding-form select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-100);
}

.onboarding-form input.field-invalid {
  border-color: var(--error);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.08);
}

/* ── Markup slider ───────────────────────────────────────────────────── */

.onboarding-markup-group {
  margin-top: 18px;
}

.onboarding-markup-group label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}

.onboarding-markup-group input[type="range"] {
  width: 100%;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--border-light);
  border-radius: 3px;
  outline: none;
  border: none;
  padding: 0;
}

.onboarding-markup-group input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(99, 102, 241, 0.3);
  transition: box-shadow 0.2s ease;
}

.onboarding-markup-group input[type="range"]::-webkit-slider-thumb:hover {
  box-shadow: 0 2px 10px rgba(99, 102, 241, 0.5);
}

.onboarding-markup-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ── Ready step ──────────────────────────────────────────────────────── */

.onboarding-ready {
  text-align: center;
}

.onboarding-ready-icon {
  margin: 0 auto 16px;
  animation: welcomeBounce 0.6s ease-out;
}

.onboarding-summary {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0 auto 20px;
  max-width: 360px;
  text-align: left;
}

.onboarding-summary-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg);
  border-radius: 10px;
  font-size: 13px;
}

.onboarding-summary-icon {
  display: flex;
  color: var(--primary);
  flex-shrink: 0;
}

.onboarding-summary-label {
  color: var(--text-muted);
  min-width: 90px;
}

.onboarding-summary-value {
  font-weight: 600;
  color: var(--text);
}

.onboarding-quick-links {
  margin-top: 4px;
}

.onboarding-quick-links h3 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 12px;
}

.onboarding-links-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.onboarding-link-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 10px;
  background: var(--bg);
  border-radius: 12px;
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

.onboarding-link-card:hover {
  background: var(--primary-50);
  border-color: var(--primary-100);
  color: var(--primary);
  transform: translateY(-2px);
}

.onboarding-link-card svg {
  opacity: 0.6;
}

.onboarding-link-card:hover svg {
  opacity: 1;
}

/* ── Footer ──────────────────────────────────────────────────────────── */

.onboarding-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px 24px;
  gap: 12px;
}

.onboarding-footer-left,
.onboarding-footer-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.onboarding-footer .btn svg {
  width: 14px;
  height: 14px;
}

/* ── Responsive ──────────────────────────────────────────────────────── */

@media (max-width: 640px) {
  .onboarding-container {
    padding: 12px;
    align-items: flex-start;
    padding-top: 12px;
  }

  .onboarding-wrapper {
    border-radius: 16px;
    max-width: 100%;
  }

  .onboarding-header,
  .onboarding-step-viewport,
  .onboarding-footer {
    padding-left: 20px;
    padding-right: 20px;
  }

  .onboarding-progress {
    margin-left: 20px;
    margin-right: 20px;
  }

  .onboarding-form-grid {
    grid-template-columns: 1fr;
  }

  .onboarding-links-grid {
    grid-template-columns: 1fr;
  }

  .onboarding-steps {
    padding-left: 12px;
    padding-right: 12px;
  }

  .onboarding-dot-label {
    font-size: 10px;
  }

  .onboarding-step-line {
    width: 20px;
  }

  .onboarding-title {
    font-size: 20px;
  }
}


/* ==========================================================================
   36. HELP & SUPPORT
   ========================================================================== */

.help-container {
  max-width: 800px;
  margin: 0 auto;
}

.help-container .view-header h1 {
  display: flex;
  align-items: center;
  gap: 10px;
}

.help-container .view-header h1 svg {
  color: var(--primary);
}

/* ── Tabs ─────────────────────────────────────────────────────────────── */

.help-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--bg);
  border-radius: 12px;
  margin-bottom: 24px;
}

.help-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  justify-content: center;
  position: relative;
}

.help-tab:hover {
  color: var(--text);
  background: var(--surface-hover);
}

.help-tab.active {
  color: var(--primary);
  background: var(--surface);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.help-tab svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.help-tab-dot {
  position: absolute;
  top: 8px;
  right: 12px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--error);
  animation: pulse 2s infinite;
}

/* ── FAQ ──────────────────────────────────────────────────────────────── */

.help-search {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  margin-bottom: 16px;
  transition: border-color 0.2s ease;
}

.help-search:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-100);
}

.help-search svg {
  color: var(--text-muted);
  flex-shrink: 0;
}

.help-search input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  color: var(--text);
  outline: none;
}

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

.help-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 14px;
}

/* ── FAQ Accordion ───────────────────────────────────────────────────── */

.faq-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.faq-item {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  overflow: hidden;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.faq-item:hover {
  border-color: var(--border);
}

.faq-item.open {
  border-color: var(--primary-200);
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.06);
}

.faq-question {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 14px 16px;
  font-size: 14px;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  color: var(--text);
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  gap: 12px;
  transition: color 0.2s ease;
}

.faq-question:hover {
  color: var(--primary);
}

.faq-chevron {
  display: flex;
  color: var(--text-muted);
  transition: transform 0.3s ease;
  flex-shrink: 0;
}

.faq-chevron svg {
  width: 16px;
  height: 16px;
}

.faq-item.open .faq-chevron {
  transform: rotate(180deg);
  color: var(--primary);
}

.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.faq-answer p {
  padding: 0 16px 14px;
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.7;
  margin: 0;
}

/* ── Shortcuts ───────────────────────────────────────────────────────── */

.help-shortcuts {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.shortcut-group h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-light);
}

.shortcut-table {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.shortcut-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: 8px;
  transition: background 0.15s ease;
}

.shortcut-row:hover {
  background: var(--bg);
}

.shortcut-keys {
  display: flex;
  align-items: center;
  gap: 4px;
}

.shortcut-keys kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  padding: 3px 8px;
  font-size: 12px;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 1px 0 var(--border);
}

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

.shortcut-desc {
  font-size: 13px;
  color: var(--text-secondary);
}

/* ── Changelog ───────────────────────────────────────────────────────── */

.help-changelog {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.changelog-entry {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 20px;
  transition: border-color 0.2s ease;
}

.changelog-entry.latest {
  border-color: var(--primary-200);
  box-shadow: 0 2px 12px rgba(99, 102, 241, 0.06);
}

.changelog-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.changelog-version {
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-50);
  padding: 2px 10px;
  border-radius: 6px;
}

.changelog-date {
  font-size: 12px;
  color: var(--text-muted);
}

.changelog-badge {
  font-size: 10px;
  font-weight: 700;
  color: white;
  background: var(--success);
  padding: 2px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.changelog-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 10px;
}

.changelog-items {
  margin: 0;
  padding: 0 0 0 18px;
  list-style: disc;
}

.changelog-items li {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.7;
  padding: 2px 0;
}

/* ── Contact ─────────────────────────────────────────────────────────── */

.help-contact {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 24px;
}

.help-contact-info h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 8px;
}

.help-contact-info p {
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0 0 16px;
}

.help-contact-methods {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.help-contact-method {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-secondary);
}

.help-contact-method svg {
  color: var(--primary);
  flex-shrink: 0;
}

.help-contact-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--bg);
  padding: 20px;
  border-radius: 12px;
}

.help-contact-form .form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.help-contact-form label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
}

.help-contact-form select,
.help-contact-form textarea {
  padding: 9px 12px;
  font-size: 13.5px;
  font-family: 'Inter', sans-serif;
  color: var(--text);
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  resize: vertical;
  width: 100%;
  box-sizing: border-box;
}

.help-contact-form select:focus,
.help-contact-form textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-100);
}

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

  .help-tabs {
    flex-wrap: wrap;
  }

  .help-tab {
    font-size: 12px;
    padding: 8px 10px;
  }
}


/* ==========================================================================
   37. KEYBOARD SHORTCUTS MODAL
   ========================================================================== */

.shortcuts-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.shortcuts-modal-overlay.open {
  opacity: 1;
}

.shortcuts-modal-overlay.closing {
  opacity: 0;
}

.shortcuts-modal {
  width: 90%;
  max-width: 560px;
  max-height: 80vh;
  background: var(--surface);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.96);
  transition: transform 0.2s ease;
}

.shortcuts-modal-overlay.open .shortcuts-modal {
  transform: scale(1);
}

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

.shortcuts-modal-header h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

.shortcuts-modal-header h2 svg {
  color: var(--primary);
}

.shortcuts-modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: var(--text-muted);
  background: none;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.shortcuts-modal-close:hover {
  background: var(--bg);
  color: var(--text);
}

.shortcuts-modal-body {
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.shortcuts-modal-group h3 {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 0 0 10px;
}

.shortcuts-modal-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.shortcuts-modal-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  border-radius: 6px;
  transition: background 0.15s ease;
}

.shortcuts-modal-item:hover {
  background: var(--bg);
}

.shortcuts-modal-desc {
  font-size: 13px;
  color: var(--text-secondary);
}

.shortcuts-modal-keys {
  display: flex;
  align-items: center;
  gap: 3px;
}

.shortcuts-modal-keys kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  padding: 2px 7px;
  font-size: 11px;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 5px;
  box-shadow: 0 1px 0 var(--border);
}

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


/* ==========================================================================
   38. OFFLINE BANNER
   ========================================================================== */

.offline-banner {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: var(--warning);
  color: white;
  font-size: 13px;
  font-weight: 500;
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  animation: offlineBannerIn 0.3s ease-out;
}

@keyframes offlineBannerIn {
  from { opacity: 0; transform: translateX(-50%) translateY(12px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.offline-banner svg {
  flex-shrink: 0;
}


/* ==========================================================================
   39. TOPBAR HELP BUTTON
   ========================================================================== */

.topbar-help-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.topbar-help-btn:hover {
  background: var(--primary-50);
  color: var(--primary);
}

.topbar-help-btn svg {
  width: 18px;
  height: 18px;
}


/* ==========================================================================
   40. SIDEBAR BADGE DOT (What's New indicator)
   ========================================================================== */

.sidebar-badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--error);
  flex-shrink: 0;
  margin-left: auto;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
/* ==========================================================================
   PRICING PAGE
   ========================================================================== */

.view-pricing {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem;
}

.pricing-toggle-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 2.5rem;
}

.pricing-toggle {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--bg);
  padding: 0.5rem 1.25rem;
  border-radius: 100px;
  border: 1px solid var(--border);
}

.pricing-toggle-label {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: color 0.2s;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.pricing-toggle-label.active {
  color: var(--text);
  font-weight: 600;
}

.pricing-toggle-badge {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--success);
  background: var(--success-light);
  padding: 2px 8px;
  border-radius: 100px;
  letter-spacing: 0.02em;
}

.pricing-toggle-switch {
  position: relative;
  width: 48px;
  height: 26px;
  background: var(--border-strong);
  border: none;
  border-radius: 100px;
  cursor: pointer;
  transition: background 0.25s ease;
  padding: 0;
}

.pricing-toggle-switch.on {
  background: var(--primary);
}

.pricing-toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  background: white;
  border-radius: 50%;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.pricing-toggle-switch.on .pricing-toggle-thumb {
  transform: translateX(22px);
}

.pricing-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin-bottom: 3rem;
  align-items: start;
}

.pricing-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2rem;
  position: relative;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  display: flex;
  flex-direction: column;
}

.pricing-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.08);
}

.pricing-card--popular {
  border: 2px solid transparent;
  background-image: linear-gradient(var(--surface), var(--surface)),
                    linear-gradient(135deg, var(--primary), var(--accent));
  background-origin: border-box;
  background-clip: padding-box, border-box;
  transform: scale(1.03);
  box-shadow: 0 8px 32px rgba(99, 102, 241, 0.15);
  z-index: 1;
}

.pricing-card--popular:hover {
  transform: scale(1.03) translateY(-4px);
  box-shadow: 0 16px 48px rgba(99, 102, 241, 0.2);
}

.pricing-card--current {
  border-color: var(--primary-200);
}

.pricing-popular-badge {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 16px;
  border-radius: 100px;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.pricing-current-badge {
  position: absolute;
  top: -12px;
  right: 1.5rem;
  background: var(--success);
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 12px;
  border-radius: 100px;
  letter-spacing: 0.03em;
}

.pricing-card-header { margin-bottom: 1.25rem; }

.pricing-plan-name {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0 0 0.25rem;
}

.pricing-plan-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin: 0;
}

.pricing-price-block {
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-light);
}

.pricing-price-row {
  display: flex;
  align-items: baseline;
  gap: 0.25rem;
}

.pricing-price {
  font-size: 2.75rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1;
}

.pricing-price-original {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: line-through;
  margin-right: 0.25rem;
}

.pricing-price-period {
  font-size: 0.9rem;
  color: var(--text-muted);
  font-weight: 500;
}

.pricing-savings {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--success);
  margin-top: 0.4rem;
}

.pricing-billed-info {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.pricing-features-list {
  flex: 1;
  margin-bottom: 1.5rem;
}

.pricing-limits {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.pricing-limit-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.pricing-limit-item svg { width: 16px; height: 16px; opacity: 0.6; }

.pricing-feature-divider {
  height: 1px;
  background: var(--border-light);
  margin-bottom: 1rem;
}

.pricing-feature-item {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  padding: 0.3rem 0;
  line-height: 1.4;
}

.pricing-feature-check {
  flex-shrink: 0;
  color: var(--success);
  margin-top: 1px;
}

.pricing-feature-check svg { width: 16px; height: 16px; }

.pricing-card-footer { margin-top: auto; }

.pricing-cta-btn {
  width: 100%;
  padding: 0.75rem 1.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: 10px;
  transition: all 0.2s ease;
}

.pricing-card--popular .pricing-cta-btn.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-color: transparent;
}

.pricing-card--popular .pricing-cta-btn.btn-primary:hover {
  opacity: 0.9;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.3);
}

.pricing-guarantee {
  display: flex;
  justify-content: center;
  margin-bottom: 3rem;
}

.pricing-guarantee-inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--success-light);
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: 12px;
  padding: 1rem 1.75rem;
  max-width: 480px;
}

.pricing-guarantee-icon { flex-shrink: 0; }

.pricing-comparison { margin-bottom: 3rem; }

.pricing-comparison-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}

.pricing-comparison-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.pricing-comparison-table th,
.pricing-comparison-table td {
  padding: 0.75rem 1rem;
  text-align: center;
  border-bottom: 1px solid var(--border-light);
}

.pricing-comparison-table th {
  font-weight: 600;
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 1;
}

.pricing-comparison-table th:first-child,
.pricing-comparison-table td:first-child {
  text-align: left;
  font-weight: 500;
}

.comparison-feature-label { color: var(--text-secondary); }
.comparison-current { background: var(--primary-50); }
.comparison-check { color: var(--success); display: inline-flex; }
.comparison-check svg { width: 18px; height: 18px; }
.comparison-x { color: var(--text-disabled); font-size: 1.1rem; }

.comparison-partial {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--warning-dark);
  background: var(--warning-light);
  padding: 2px 8px;
  border-radius: 4px;
}

.pricing-faq {
  max-width: 720px;
  margin: 0 auto 3rem;
}

.pricing-faq-list {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface);
}

.pricing-faq-item { border-bottom: 1px solid var(--border-light); }
.pricing-faq-item:last-child { border-bottom: none; }

.pricing-faq-question {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 1rem 1.25rem;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text);
  text-align: left;
  transition: background 0.15s;
  font-family: inherit;
  gap: 1rem;
}

.pricing-faq-question:hover { background: var(--surface-hover); }

.pricing-faq-chevron {
  flex-shrink: 0;
  color: var(--text-muted);
  transition: transform 0.25s ease;
}

.pricing-faq-chevron svg { width: 18px; height: 18px; }

.pricing-faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease;
  padding: 0 1.25rem;
}

.pricing-faq-item.open .pricing-faq-answer {
  max-height: 200px;
  padding: 0 1.25rem 1rem;
}

.pricing-faq-answer p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.6;
}


/* ==========================================================================
   BILLING PAGE
   ========================================================================== */

.view-billing {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem;
}

.billing-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.billing-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

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

.billing-card-header h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0;
}

.billing-card-body { padding: 1.25rem; flex: 1; }

.billing-card-footer {
  padding: 0.75rem 1.25rem;
  border-top: 1px solid var(--border-light);
  background: var(--bg);
}

.plan-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 100px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.plan-badge-sm {
  font-size: 0.6rem;
  padding: 2px 7px;
  margin-left: 0.5rem;
}

.billing-plan-price {
  display: flex;
  align-items: baseline;
  gap: 0.25rem;
  margin-bottom: 1rem;
}

.billing-price-amount {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text);
}

.billing-price-period {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.billing-cancel-notice {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  background: var(--warning-light);
  border: 1px solid rgba(245, 158, 11, 0.2);
  border-radius: 8px;
  padding: 0.75rem;
  margin-bottom: 1rem;
  font-size: 0.8rem;
  color: var(--warning-dark);
}

.billing-cancel-notice svg { flex-shrink: 0; width: 16px; height: 16px; }

.billing-next-billing,
.billing-plan-status {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
}

.billing-label { font-size: 0.8rem; color: var(--text-muted); font-weight: 500; }
.billing-value { font-size: 0.85rem; font-weight: 600; color: var(--text); }

.billing-status-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 100px;
  text-transform: capitalize;
}

.billing-status-active { background: var(--success-light); color: var(--success-dark); }
.billing-status-cancelled { background: var(--error-light); color: var(--error-dark); }
.billing-status-paid { background: var(--success-light); color: var(--success-dark); }
.billing-status-pending { background: var(--warning-light); color: var(--warning-dark); }

.billing-payment-display { display: flex; justify-content: center; }

.billing-card-visual {
  width: 280px;
  height: 170px;
  background: linear-gradient(135deg, #1e293b, #334155);
  border-radius: 14px;
  padding: 1.25rem;
  position: relative;
  color: white;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}

.billing-card-chip {
  width: 36px;
  height: 26px;
  background: linear-gradient(135deg, #d4af37, #f5deb3);
  border-radius: 4px;
}

.billing-card-number {
  font-size: 1.1rem;
  font-weight: 500;
  letter-spacing: 2px;
  font-family: monospace;
}

.billing-card-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
}

.billing-card-meta-label {
  display: block;
  font-size: 0.6rem;
  text-transform: uppercase;
  opacity: 0.7;
  margin-bottom: 2px;
}

.billing-card-brand {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
}

.billing-empty-payment,
.billing-empty-invoices {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 1.5rem 0;
  gap: 0.5rem;
  color: var(--text-muted);
}

.billing-empty-payment svg,
.billing-empty-invoices svg { width: 32px; height: 32px; opacity: 0.4; }

.billing-empty-payment p,
.billing-empty-invoices p { margin: 0; font-weight: 500; color: var(--text-secondary); }

.billing-usage-item { margin-bottom: 1.25rem; }
.billing-usage-item:last-child { margin-bottom: 0; }

.billing-usage-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  margin-bottom: 0.4rem;
}

.billing-usage-count { font-weight: 600; color: var(--text); }

.billing-usage-bar {
  height: 8px;
  background: var(--bg);
  border-radius: 100px;
  overflow: hidden;
}

.billing-usage-fill {
  height: 100%;
  border-radius: 100px;
  transition: width 0.5s ease;
  min-width: 4px;
}

.billing-section { margin-bottom: 2rem; }
.billing-section h2 { font-size: 1.1rem; font-weight: 600; margin-bottom: 1rem; }

.billing-table-wrap {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface);
}

.billing-invoice-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.billing-invoice-table th {
  text-align: left;
  padding: 0.75rem 1rem;
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--text-secondary);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.billing-invoice-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-light);
}

.billing-invoice-table tr:last-child td { border-bottom: none; }

.invoice-download-btn {
  display: inline-flex;
  padding: 4px;
  color: var(--text-muted);
}
.invoice-download-btn:hover { color: var(--primary); }
.invoice-download-btn svg { width: 16px; height: 16px; }

.billing-danger-zone {
  border-top: 1px solid var(--border);
  padding-top: 1.5rem;
}

.billing-danger-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--error-light);
  border: 1px solid rgba(239, 68, 68, 0.15);
  border-radius: 12px;
  padding: 1.25rem;
  gap: 1rem;
}


/* ==========================================================================
   CHECKOUT SUCCESS / CANCEL
   ========================================================================== */

.checkout-success,
.checkout-cancel {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  padding: 2rem;
  position: relative;
}

.checkout-success-card,
.checkout-cancel-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 3rem;
  text-align: center;
  max-width: 520px;
  width: 100%;
  z-index: 1;
}

.checkout-success-icon,
.checkout-cancel-icon { margin-bottom: 1.5rem; }

.checkout-success-title,
.checkout-cancel-title {
  font-size: 1.75rem;
  font-weight: 700;
  margin: 0 0 0.5rem;
}

.checkout-success-subtitle,
.checkout-cancel-subtitle {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin: 0 0 2rem;
  line-height: 1.5;
}

.checkout-success-features {
  text-align: left;
  margin-bottom: 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.checkout-success-feature {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.checkout-feature-check { color: var(--success); flex-shrink: 0; }
.checkout-feature-check svg { width: 18px; height: 18px; }

.checkout-success-actions,
.checkout-cancel-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.checkout-success-redirect { font-size: 0.8rem; color: var(--text-muted); }

.checkout-cancel-help {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-light);
}

.checkout-cancel-help p { font-size: 0.85rem; color: var(--text-muted); margin: 0 0 0.75rem; }

.checkout-cancel-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--primary);
  font-weight: 600;
  font-size: 0.85rem;
  text-decoration: none;
}
.checkout-cancel-link:hover { text-decoration: underline; }
.checkout-cancel-link svg { width: 16px; height: 16px; }

.confetti-container {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

@keyframes confetti-fall {
  0% { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(80vh) rotate(720deg); opacity: 0; }
}


/* ==========================================================================
   SIDEBAR UPGRADE BUTTON & PLAN BADGE
   ========================================================================== */

.sidebar-upgrade-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.875rem;
  margin: 0 0 0.5rem;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.2s;
}

.sidebar-upgrade-btn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.sidebar-upgrade-btn svg { width: 16px; height: 16px; }
.collapsed .sidebar-upgrade-btn span { display: none; }
.collapsed .sidebar-upgrade-btn { justify-content: center; padding: 0.6rem; }
.sidebar-billing-link { margin-bottom: 0.5rem; }


/* ==========================================================================
   UPGRADE MODAL (Feature Gating)
   ========================================================================== */

.upgrade-modal-content { text-align: center; padding: 1rem 0; }
.upgrade-modal-icon { margin-bottom: 1rem; }
.upgrade-modal-icon svg { width: 48px; height: 48px; color: var(--primary); }

.upgrade-modal-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0 0 0.5rem;
}

.upgrade-modal-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin: 0 0 1.25rem;
  line-height: 1.5;
}

.upgrade-modal-plan {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--primary-100);
  color: var(--primary);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 100px;
  margin-bottom: 1rem;
}


/* RESPONSIVE: Pricing & Billing */

@media (max-width: 1200px) {
  .pricing-cards { gap: 1rem; }
  .billing-grid { grid-template-columns: repeat(2, 1fr); }
  .billing-usage-card { grid-column: span 2; }
}

@media (max-width: 768px) {
  .pricing-cards {
    grid-template-columns: 1fr;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
  }
  .pricing-card--popular { transform: none; order: -1; }
  .pricing-card--popular:hover { transform: translateY(-4px); }
  .billing-grid { grid-template-columns: 1fr; }
  .billing-usage-card { grid-column: span 1; }
  .billing-card-visual { width: 240px; height: 150px; }
  .pricing-comparison-table { font-size: 0.8rem; }
  .pricing-comparison-table th,
  .pricing-comparison-table td { padding: 0.5rem 0.75rem; }
  .checkout-success-card,
  .checkout-cancel-card { padding: 2rem 1.5rem; }
  .checkout-success-actions,
  .checkout-cancel-actions { flex-direction: column; }
  .billing-danger-card { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 480px) {
  .pricing-toggle { padding: 0.4rem 0.75rem; gap: 0.5rem; }
  .pricing-toggle-label { font-size: 0.8rem; }
  .pricing-price { font-size: 2.25rem; }
  .pricing-card { padding: 1.5rem; }
  .billing-invoice-table { font-size: 0.75rem; }
  .billing-invoice-table th,
  .billing-invoice-table td { padding: 0.5rem; }
}
