/* =============================================
   HOMESTEAD CABINET DESIGN - DESIGN SYSTEM
   Clean, professional purple/white aesthetic
   ============================================= */

/* CSS Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  /* Color Palette - Purple/Indigo with white */
  --color-primary: #6366f1;
  --color-primary-light: #818cf8;
  --color-primary-dark: #4f46e5;
  
  --color-accent: #6366f1;
  --color-accent-light: #818cf8;
  --color-accent-dark: #4f46e5;
  
  --color-success: #10b981;
  --color-success-light: #34d399;
  --color-warning: #f59e0b;
  --color-danger: #ef4444;
  --color-danger-light: #f87171;
  
  --color-bg: #ffffff;
  --color-bg-alt: #f8fafc;
  --color-bg-card: #ffffff;
  --color-bg-dark: #1e1b4b;
  --color-bg-soft: #f1f5f9;
  
  --color-text: #1e293b;
  --color-text-light: #475569;
  --color-text-muted: #94a3b8;
  --color-text-inverse: #ffffff;
  
  --color-border: #e2e8f0;
  --color-border-light: #f1f5f9;
  
  /* Typography */
  --font-display: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  
  /* Spacing Scale */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;
  
  /* Border Radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  
  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 350ms ease;
  
  /* Layout */
  --max-width: 1200px;
  --sidebar-width: 260px;
  --header-height: 70px;
}

/* Import Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

/* Base Styles */
html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--color-text);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.3;
  color: var(--color-primary);
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.125rem; }
h6 { font-size: 1rem; }

p {
  margin-bottom: var(--space-md);
}

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

a:hover {
  color: var(--color-accent-dark);
}

/* =============================================
   LAYOUT COMPONENTS
   ============================================= */

/* Container */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

/* App Layout */
.app-layout {
  display: flex;
  min-height: 100vh;
}

.app-sidebar {
  width: var(--sidebar-width);
  background: var(--color-primary);
  color: var(--color-text-inverse);
  padding: var(--space-lg);
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  overflow-x: hidden;
  overflow-y: auto;
  z-index: 100;
}

.app-main {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  overflow-x: hidden;
  max-width: calc(100vw - var(--sidebar-width));
}

.app-header {
  background: var(--color-bg-card);
  border-bottom: 1px solid var(--color-border);
  padding: var(--space-md) var(--space-xl);
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--header-height);
  flex-wrap: wrap;
  gap: var(--space-sm);
  max-width: 100%;
  overflow: hidden;
}

.app-content {
  padding: var(--space-xl);
  overflow-x: auto;
  max-width: 100%;
}

/* Sidebar Navigation */
.sidebar-logo {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--color-text-inverse);
  margin-bottom: var(--space-2xl);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  overflow: hidden;
}

.sidebar-logo a {
  display: block;
  max-width: 100%;
}

.sidebar-logo img {
  display: block;
  max-width: 180px;
  max-height: 50px;
  width: auto;
  height: auto;
  object-fit: contain;
}

.sidebar-logo svg {
  width: 32px;
  height: 32px;
  fill: var(--color-accent);
}

.sidebar-nav {
  list-style: none;
}

.sidebar-nav-item {
  margin-bottom: var(--space-xs);
}

.sidebar-nav-link {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  color: rgba(255, 255, 255, 0.7);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  font-weight: 500;
}

.sidebar-nav-link:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--color-text-inverse);
}

.sidebar-nav-link.active {
  background: rgba(255, 255, 255, 0.2);
  color: var(--color-text-inverse);
}

.sidebar-nav-link svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.sidebar-section {
  margin-top: var(--space-xl);
  padding-top: var(--space-lg);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-section-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.4);
  margin-bottom: var(--space-sm);
  padding: 0 var(--space-md);
}

/* =============================================
   CARD COMPONENTS
   ============================================= */

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

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

.card-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--color-primary);
  margin: 0;
}

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

.card-footer {
  padding: var(--space-lg);
  border-top: 1px solid var(--color-border);
  background: var(--color-bg-soft);
}

/* Stat Cards */
.stat-card {
  background: var(--color-bg-card);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
}

.stat-card-label {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  margin-bottom: var(--space-xs);
}

.stat-card-value {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  color: var(--color-primary);
}

.stat-card-change {
  font-size: 0.875rem;
  margin-top: var(--space-xs);
}

.stat-card-change.positive { color: var(--color-success); }
.stat-card-change.negative { color: var(--color-danger); }

/* =============================================
   FORM COMPONENTS
   ============================================= */

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

.form-label {
  display: block;
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--color-text);
  margin-bottom: var(--space-xs);
}

.form-label-optional {
  font-weight: 400;
  color: var(--color-text-muted);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--color-text);
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(201, 166, 107, 0.15);
}

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

.form-input.error {
  border-color: var(--color-danger);
}

.form-error {
  font-size: 0.875rem;
  color: var(--color-danger);
  margin-top: var(--space-xs);
}

.form-help {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  margin-top: var(--space-xs);
}

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

/* Checkbox & Radio */
.form-check {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  cursor: pointer;
}

.form-check-input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--color-accent);
  cursor: pointer;
}

.form-check-label {
  font-size: 0.9375rem;
  cursor: pointer;
}

/* Input Groups */
.input-group {
  display: flex;
  align-items: stretch;
}

.input-group .form-input {
  border-radius: var(--radius-md) 0 0 var(--radius-md);
}

.input-group-append {
  padding: var(--space-sm) var(--space-md);
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-left: 0;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  display: flex;
  align-items: center;
  color: var(--color-text-muted);
}

/* =============================================
   BUTTON COMPONENTS
   ============================================= */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-lg);
  font-family: var(--font-body);
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.5;
  text-align: center;
  text-decoration: none;
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

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

.btn svg {
  width: 18px;
  height: 18px;
}

/* Button Variants */
.btn-primary {
  background: var(--color-primary);
  color: var(--color-text-inverse);
  border-color: var(--color-primary);
}

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

.btn-secondary {
  background: var(--color-bg-card);
  color: var(--color-text);
  border-color: var(--color-border);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--color-bg-alt);
  border-color: var(--color-primary);
}

.btn-accent {
  background: var(--color-accent);
  color: var(--color-text-inverse);
  border-color: var(--color-accent);
}

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

.btn-outline {
  background: transparent;
  color: var(--color-primary);
  border-color: var(--color-primary);
}

.btn-outline:hover:not(:disabled) {
  background: var(--color-primary);
  color: var(--color-text-inverse);
}

.btn-success {
  background: var(--color-success);
  color: var(--color-text-inverse);
  border-color: var(--color-success);
}

.btn-success:hover:not(:disabled) {
  background: var(--color-success-light);
  border-color: var(--color-success-light);
}

.btn-danger {
  background: var(--color-danger);
  color: var(--color-text-inverse);
  border-color: var(--color-danger);
}

.btn-danger:hover:not(:disabled) {
  background: var(--color-danger-light);
  border-color: var(--color-danger-light);
}

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

.btn-ghost:hover:not(:disabled) {
  background: var(--color-bg-alt);
}

.btn-link {
  background: transparent;
  color: var(--color-primary);
  border-color: transparent;
  padding-left: 0;
  padding-right: 0;
}

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

/* Button Sizes */
.btn-sm {
  padding: var(--space-xs) var(--space-md);
  font-size: 0.875rem;
}

.btn-lg {
  padding: var(--space-md) var(--space-xl);
  font-size: 1.0625rem;
}

.btn-block {
  width: 100%;
}

/* Button Group */
.btn-group {
  display: flex;
  gap: var(--space-sm);
}

/* =============================================
   TABLE COMPONENTS
   ============================================= */

.table-container {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  padding: var(--space-md);
  text-align: left;
  border-bottom: 1px solid var(--color-border-light);
}

.table th {
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  background: var(--color-bg-alt);
}

.table tbody tr:hover {
  background: var(--color-bg-alt);
}

.table-actions {
  display: flex;
  gap: var(--space-xs);
  justify-content: flex-end;
}

/* =============================================
   BADGE & STATUS COMPONENTS
   ============================================= */

.badge {
  display: inline-flex;
  align-items: center;
  padding: var(--space-xs) var(--space-sm);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-radius: 9999px;
}

.badge-draft { background: #e5e7eb; color: #4b5563; }
.badge-pending { background: #fef08a; color: #854d0e; }
.badge-sent { background: #dbeafe; color: #1d4ed8; }
.badge-viewed { background: #e0e7ff; color: #4338ca; }
.badge-accepted { background: #d1fae5; color: #047857; }
.badge-declined { background: #fee2e2; color: #b91c1c; }
.badge-expired { background: #fef3c7; color: #b45309; }
.badge-partial { background: #fef3c7; color: #b45309; }
.badge-paid { background: #d1fae5; color: #047857; }
.badge-overdue { background: #fee2e2; color: #b91c1c; }
.badge-archived { background: #9ca3af; color: #1f2937; }
.badge-converted { background: #c7d2fe; color: #3730a3; }
.badge-cancelled { background: #e5e7eb; color: #6b7280; }

/* =============================================
   QUOTE DISPLAY COMPONENTS
   ============================================= */

.quote-header {
  background: var(--color-bg-card);
  color: var(--color-text);
  padding: var(--space-2xl);
  text-align: center;
  border-bottom: 1px solid var(--color-border);
}

.quote-number {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  margin-bottom: var(--space-sm);
}

.quote-title {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 600;
  margin-bottom: var(--space-sm);
  color: var(--color-primary);
}

.quote-customer {
  font-size: 1.125rem;
  color: var(--color-text-light);
}

.quote-video {
  margin: var(--space-xl) 0;
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.quote-video iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: none;
}

/* Line Items */
.line-item {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: var(--space-md);
  padding: var(--space-md) 0;
  border-bottom: 1px solid var(--color-border-light);
  align-items: start;
}

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

.line-item-checkbox {
  padding-top: var(--space-xs);
}

.line-item-photo {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.line-item-content {
  min-width: 0;
}

.line-item-name {
  font-weight: 600;
  margin-bottom: var(--space-xs);
}

.line-item-details {
  font-size: 0.875rem;
  color: var(--color-text-light);
}

.line-item-price {
  text-align: right;
  white-space: nowrap;
}

.line-item-price-value {
  font-weight: 600;
  font-size: 1.125rem;
}

.line-item-price-range {
  color: var(--color-text-light);
  font-size: 0.875rem;
}

.line-item.optional {
  background: var(--color-bg-alt);
  margin: 0 calc(var(--space-lg) * -1);
  padding-left: var(--space-lg);
  padding-right: var(--space-lg);
}

.line-item.optional .line-item-name::before {
  content: 'Optional: ';
  color: var(--color-text-muted);
  font-weight: 400;
}

/* Quote Totals */
.quote-totals {
  background: var(--color-bg-alt);
  padding: var(--space-lg);
  border-radius: var(--radius-lg);
  margin-top: var(--space-xl);
}

.quote-total-row {
  display: flex;
  justify-content: space-between;
  padding: var(--space-sm) 0;
}

.quote-total-row.subtotal {
  border-bottom: 1px solid var(--color-border);
  padding-bottom: var(--space-md);
  margin-bottom: var(--space-sm);
}

.quote-total-row.grand-total {
  border-top: 2px solid var(--color-primary);
  padding-top: var(--space-md);
  margin-top: var(--space-sm);
  font-size: 1.25rem;
  font-weight: 700;
}

.quote-total-label {
  color: var(--color-text-light);
}

.quote-total-value {
  font-weight: 600;
}

.quote-deposit-note {
  text-align: center;
  margin-top: var(--space-lg);
  padding: var(--space-md);
  background: rgba(201, 166, 107, 0.1);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-accent);
}

/* =============================================
   FILE UPLOAD COMPONENTS
   ============================================= */

.upload-zone {
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-2xl);
  text-align: center;
  background: var(--color-bg-alt);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--color-accent);
  background: rgba(201, 166, 107, 0.05);
}

.upload-zone-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto var(--space-md);
  color: var(--color-text-muted);
}

.upload-zone-text {
  color: var(--color-text-light);
  margin-bottom: var(--space-sm);
}

.upload-zone-hint {
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

/* File Grid */
.file-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: var(--space-md);
  margin-top: var(--space-lg);
}

.file-card {
  background: var(--color-bg-card);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.file-card-preview {
  aspect-ratio: 1;
  background: var(--color-bg-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.file-card-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.file-card-preview svg {
  width: 48px;
  height: 48px;
  color: var(--color-text-muted);
}

.file-card-info {
  padding: var(--space-sm);
}

.file-card-name {
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-card-actions {
  display: flex;
  gap: var(--space-xs);
  margin-top: var(--space-xs);
}

/* =============================================
   MODAL COMPONENTS
   ============================================= */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-base);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--color-bg-card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow: hidden;
  transform: scale(0.95);
  transition: transform var(--transition-base);
}

.modal-overlay.active .modal {
  transform: scale(1);
}

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

.modal-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  padding: var(--space-xs);
  cursor: pointer;
  color: var(--color-text-muted);
  border-radius: var(--radius-sm);
}

.modal-close:hover {
  background: var(--color-bg-alt);
  color: var(--color-text);
}

.modal-body {
  padding: var(--space-lg);
  overflow-y: auto;
  max-height: calc(90vh - 140px);
}

.modal-footer {
  padding: var(--space-lg);
  border-top: 1px solid var(--color-border-light);
  display: flex;
  gap: var(--space-sm);
  justify-content: flex-end;
}

/* =============================================
   ALERT & TOAST COMPONENTS
   ============================================= */

.alert {
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-lg);
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
}

.alert-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
}

.alert-content {
  flex: 1;
}

.alert-title {
  font-weight: 600;
  margin-bottom: var(--space-xs);
}

.alert-info {
  background: #dbeafe;
  border: 1px solid #93c5fd;
  color: #1e40af;
}

.alert-success {
  background: #d1fae5;
  border: 1px solid #6ee7b7;
  color: #047857;
}

.alert-warning {
  background: #fef3c7;
  border: 1px solid #fcd34d;
  color: #b45309;
}

.alert-danger {
  background: #fee2e2;
  border: 1px solid #fca5a5;
  color: #b91c1c;
}

/* Toast */
.toast-container {
  position: fixed;
  bottom: var(--space-lg);
  right: var(--space-lg);
  z-index: 1100;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.toast {
  background: var(--color-bg-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: var(--space-md) var(--space-lg);
  display: flex;
  align-items: center;
  gap: var(--space-md);
  min-width: 300px;
  animation: slideIn 0.3s ease;
}

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

/* =============================================
   LOADING STATES
   ============================================= */

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

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

.loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.skeleton {
  background: linear-gradient(90deg, var(--color-bg-alt) 25%, var(--color-bg) 50%, var(--color-bg-alt) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

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

/* =============================================
   UTILITY CLASSES
   ============================================= */

/* Spacing */
.mt-0 { margin-top: 0; }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }

.mb-0 { margin-bottom: 0; }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }

.p-0 { padding: 0; }
.p-sm { padding: var(--space-sm); }
.p-md { padding: var(--space-md); }
.p-lg { padding: var(--space-lg); }
.p-xl { padding: var(--space-xl); }

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

/* Grid */
.grid { display: grid; }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }

/* Text */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-sm { font-size: 0.875rem; }
.text-lg { font-size: 1.125rem; }
.text-muted { color: var(--color-text-muted); }
.text-success { color: var(--color-success); }
.text-danger { color: var(--color-danger); }
.font-bold { font-weight: 700; }

/* Display */
.hidden { display: none; }
.block { display: block; }
.inline-block { display: inline-block; }

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

/* Mobile Menu Toggle Button */
.mobile-menu-toggle {
  display: none;
  background: var(--color-primary);
  color: white;
  border: none;
  padding: var(--space-sm);
  border-radius: var(--radius-md);
  cursor: pointer;
  z-index: 200;
}

.mobile-menu-toggle svg {
  width: 24px;
  height: 24px;
}

/* Sidebar Overlay */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 99;
}

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

@media (max-width: 1024px) {
  .grid-cols-4 { grid-template-columns: repeat(3, 1fr); }
  
  .app-content {
    padding: var(--space-lg);
  }
}

@media (max-width: 768px) {
  /* Show mobile menu toggle */
  .mobile-menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  /* Sidebar slides in from left */
  .app-sidebar {
    transform: translateX(-100%);
    transition: transform var(--transition-base);
    width: 280px;
  }
  
  .app-sidebar.open {
    transform: translateX(0);
  }
  
  /* Main content full width */
  .app-main {
    margin-left: 0;
    max-width: 100vw;
  }
  
  /* Header adjustments */
  .app-header {
    padding: var(--space-sm) var(--space-md);
    min-height: auto;
    gap: var(--space-xs);
  }
  
  .app-header h2 {
    font-size: 1.1rem;
    display: none;
  }
  
  /* Content padding */
  .app-content {
    padding: var(--space-md);
  }
  
  /* Grid layouts */
  .grid-cols-2,
  .grid-cols-3,
  .grid-cols-4 {
    grid-template-columns: 1fr;
  }
  
  /* Cards */
  .card {
    margin-bottom: var(--space-md);
  }
  
  .card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-sm);
  }
  
  /* Buttons - make them stack on mobile */
  .pipeline-actions,
  .btn-group {
    flex-wrap: wrap;
    gap: var(--space-xs);
  }
  
  .pipeline-actions .btn,
  .btn-group .btn {
    flex: 1 1 auto;
    min-width: 80px;
    font-size: 0.75rem;
    padding: var(--space-xs) var(--space-sm);
  }
  
  /* View toggle */
  .view-toggle {
    width: 100%;
    justify-content: center;
  }
  
  .view-toggle button {
    flex: 1;
    text-align: center;
  }
  
  /* Forms */
  .form-grid,
  .form-row {
    grid-template-columns: 1fr !important;
  }
  
  .form-group {
    margin-bottom: var(--space-md);
  }
  
  .form-input,
  .form-select,
  .form-textarea {
    font-size: 16px; /* Prevents zoom on iOS */
  }
  
  /* Tables - horizontal scroll */
  .table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  table {
    min-width: 600px;
  }
  
  /* Hide table columns on mobile */
  .hide-mobile {
    display: none !important;
  }
  
  /* Line items */
  .line-item {
    grid-template-columns: auto 1fr;
  }
  
  .line-item-price {
    grid-column: 2;
    text-align: left;
    margin-top: var(--space-sm);
  }
  
  /* Modals */
  .modal-overlay {
    padding: var(--space-sm);
    align-items: flex-start;
    overflow-y: auto;
  }
  
  .modal {
    margin: var(--space-md);
    max-width: calc(100% - var(--space-md));
    max-height: none;
    width: 100%;
  }
  
  .modal-body {
    max-height: none;
  }
  
  /* Dropdowns */
  .dropdown-menu {
    position: fixed;
    left: var(--space-sm) !important;
    right: var(--space-sm) !important;
    top: auto !important;
    bottom: var(--space-sm);
    width: auto !important;
    max-height: 60vh;
    overflow-y: auto;
  }
  
  /* Stats cards */
  .stat-card {
    padding: var(--space-md);
  }
  
  .stat-value {
    font-size: 1.5rem;
  }
  
  /* Pipeline columns - horizontal scroll */
  .pipeline-container {
    padding-bottom: var(--space-md);
  }
  
  .pipeline-column {
    flex: 0 0 85vw;
    max-width: 85vw;
  }
  
  /* Calendar */
  .calendar-day {
    min-height: 60px;
    padding: 2px;
  }
  
  .calendar-day-number {
    width: 22px;
    height: 22px;
    font-size: 0.7rem;
  }
  
  .calendar-event {
    font-size: 0.55rem;
    padding: 1px 3px;
  }
  
  .calendar-legend {
    display: none;
  }
  
  .calendar-nav-btn {
    width: 32px;
    height: 32px;
  }
  
  .calendar-title {
    font-size: 1rem;
    min-width: auto;
  }
  
  /* Sidebar sections */
  .sidebar-section-title {
    font-size: 0.65rem;
  }
  
  .sidebar-nav-link {
    font-size: 0.85rem;
    padding: var(--space-sm);
  }
  
  /* Quote builder specific */
  .quote-layout {
    flex-direction: column;
  }
  
  .quote-sidebar {
    width: 100%;
    position: relative;
    max-height: 300px;
    overflow-y: auto;
  }
  
  /* Flex utilities */
  .flex-mobile-col {
    flex-direction: column;
  }
  
  /* Spacing utilities for mobile */
  .mb-mobile-md {
    margin-bottom: var(--space-md);
  }
  
  /* Text utilities */
  .text-truncate-mobile {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

/* Extra small devices */
@media (max-width: 480px) {
  .app-header {
    padding: var(--space-xs) var(--space-sm);
  }
  
  .app-content {
    padding: var(--space-sm);
  }
  
  .btn {
    padding: var(--space-xs) var(--space-sm);
    font-size: 0.75rem;
  }
  
  .btn-sm {
    padding: 4px 8px;
    font-size: 0.7rem;
  }
  
  .pipeline-column {
    flex: 0 0 90vw;
    max-width: 90vw;
  }
  
  .calendar-day {
    min-height: 50px;
  }
  
  .modal {
    margin: var(--space-xs);
    max-width: calc(100% - var(--space-sm));
  }
  
  .card-body {
    padding: var(--space-sm);
  }
  
  .form-label {
    font-size: 0.8rem;
  }
}

/* =============================================
   PORTAL-SPECIFIC STYLES
   ============================================= */

.portal-container {
  max-width: 900px;
  margin: 0 auto;
  padding: var(--space-xl);
}

.portal-header {
  background: var(--color-primary);
  color: var(--color-text-inverse);
  padding: var(--space-lg) var(--space-xl);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.portal-logo {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--color-text-inverse);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.portal-nav {
  display: flex;
  gap: var(--space-lg);
}

.portal-nav-link {
  color: rgba(255, 255, 255, 0.8);
  font-weight: 500;
  transition: color var(--transition-fast);
}

.portal-nav-link:hover,
.portal-nav-link.active {
  color: var(--color-text-inverse);
}

/* Login Page */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--color-bg) 0%, var(--color-bg-alt) 100%);
}

.login-card {
  width: 100%;
  max-width: 420px;
  margin: var(--space-lg);
}

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

.login-logo h1 {
  font-family: var(--font-display);
  font-size: 1.75rem;
  color: var(--color-primary);
}

/* Print Styles */
@media print {
  .app-sidebar,
  .app-header,
  .btn,
  .no-print {
    display: none !important;
  }
  
  .app-main {
    margin-left: 0;
  }
  
  body {
    background: white;
  }
  
  .card {
    box-shadow: none;
    border: 1px solid #ddd;
  }
}
