/**
 * COMPLAINTS.CSS
 * Customer Complaints Quality Management System
 * Rogue Origin Hemp Processing
 *
 * Premium dark-first design with glassmorphism
 * Fortune-500 quality management aesthetic
 * Mobile-responsive, accessible, bilingual-ready
 */

/* ============================================
   APP LAYOUT
   ============================================ */

.app-container {
  display: flex;
  min-height: 100vh;
  background: var(--bg);
}

.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: 260px;
  background: #070908;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="light"] .sidebar {
  background: #ffffff;
  border-right: 1px solid #e5e7eb;
}

.sidebar.collapsed {
  transform: translateX(-260px);
}

.main {
  flex: 1;
  margin-left: 260px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.sidebar.collapsed ~ .main {
  margin-left: 0;
}

/* ============================================
   SIDEBAR
   ============================================ */

.sidebar-header {
  padding: var(--space-md);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

[data-theme="light"] .sidebar-header {
  border-bottom-color: #e5e7eb;
}

.sidebar-logo {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 6px rgba(102, 137, 113, 0.2));
}

.sidebar-brand {
  font-family: var(--font-display);
  font-size: 1.375rem;
  font-weight: 400;
  color: var(--text);
  letter-spacing: -0.01em;
  line-height: 1.2;
}

[data-theme="light"] .sidebar-brand {
  color: #111827;
}

.sidebar-nav {
  flex: 1;
  padding: var(--space-md);
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: var(--text-secondary);
  font-family: var(--font-ui);
  font-size: 0.9375rem;
  font-weight: 500;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: var(--space-xs);
  text-decoration: none;
  border: 1px solid transparent;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.06);
}

.nav-item.active {
  background: linear-gradient(135deg,
    rgba(228, 170, 79, 0.1) 0%,
    rgba(228, 170, 79, 0.04) 100%
  );
  color: var(--ro-gold);
  border-color: rgba(228, 170, 79, 0.2);
  box-shadow: 0 0 24px rgba(228, 170, 79, 0.06);
}

[data-theme="light"] .nav-item {
  color: #6b7280;
}

[data-theme="light"] .nav-item:hover {
  background: #f9fafb;
  color: #111827;
  border-color: #e5e7eb;
}

[data-theme="light"] .nav-item.active {
  background: linear-gradient(135deg,
    rgba(102, 137, 113, 0.1) 0%,
    rgba(102, 137, 113, 0.05) 100%
  );
  color: #668971;
  border-color: rgba(102, 137, 113, 0.2);
}

.nav-item i {
  font-size: 1.125rem;
  width: 20px;
  text-align: center;
}

.sidebar-footer {
  padding: var(--space-md);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  gap: 12px;
}

[data-theme="light"] .sidebar-footer {
  border-top-color: #e5e7eb;
}

.sidebar-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--ro-green) 0%, #557d60 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 1rem;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(102, 137, 113, 0.2);
}

.sidebar-user {
  flex: 1;
  min-width: 0;
}

.sidebar-user strong {
  display: block;
  font-family: var(--font-ui);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

[data-theme="light"] .sidebar-user strong {
  color: #111827;
}

.sidebar-user small {
  display: block;
  font-family: var(--font-ui);
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ============================================
   HEADER
   ============================================ */

.header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(10, 12, 11, 0.85);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding: var(--space-sm) var(--space-md);
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

[data-theme="light"] .header {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(16px);
  border-bottom-color: #e5e7eb;
}

.menu-btn {
  display: none;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 1.25rem;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

.menu-btn:hover {
  background: rgba(255, 255, 255, 0.06);
}

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

.header-logo {
  width: 32px;
  height: 32px;
  filter: drop-shadow(0 2px 4px rgba(102, 137, 113, 0.2));
}

.header-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 400;
  color: var(--text);
  letter-spacing: -0.01em;
  margin: 0;
}

[data-theme="light"] .header-title {
  color: #111827;
}

.header-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.icon-btn {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  font-size: 1.125rem;
  cursor: pointer;
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.08);
}

.icon-btn.primary {
  background: linear-gradient(135deg, var(--ro-gold) 0%, #d89a3f 100%);
  color: #0a0c0b;
  border: none;
  box-shadow: 0 2px 12px rgba(228, 170, 79, 0.25);
}

.icon-btn.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(228, 170, 79, 0.35);
}

.icon-btn.primary.spinning i {
  animation: spin 0.6s linear infinite;
}

/* ============================================
   VIEW NAVIGATION
   ============================================ */

.view-nav {
  display: flex;
  gap: var(--space-xs);
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(10, 12, 11, 0.6);
  overflow-x: auto;
}

[data-theme="light"] .view-nav {
  background: var(--bg);
  border-bottom-color: #e5e7eb;
}

.view-nav-btn {
  padding: 10px 20px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
  font-family: var(--font-ui);
  font-size: 0.9375rem;
  font-weight: 500;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 8px;
}

[data-theme="light"] .view-nav-btn {
  border-color: var(--border);
}

.view-nav-btn:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

.view-nav-btn.active {
  background: linear-gradient(135deg,
    rgba(228, 170, 79, 0.12) 0%,
    rgba(228, 170, 79, 0.05) 100%
  );
  color: var(--ro-gold);
  border-color: rgba(228, 170, 79, 0.25);
  box-shadow: 0 0 20px rgba(228, 170, 79, 0.1);
}

.view-nav-btn i {
  font-size: 1rem;
}

/* ============================================
   VIEW CONTENT (TAB PANELS)
   ============================================ */

.view-content {
  display: none;
  flex: 1;
}

.view-content.active {
  display: block;
}

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

#view-dashboard {
  padding: var(--space-lg);
  overflow-y: auto;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.stat-card {
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-lg);
  padding: var(--space-md) var(--space-md);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 0%, rgba(255, 255, 255, 0.02) 100%);
  pointer-events: none;
}

.stat-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

[data-theme="light"] .stat-card {
  background: #ffffff;
  border-color: #e5e7eb;
  backdrop-filter: none;
}

[data-theme="light"] .stat-card:hover {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  border-color: #d1d5db;
}

.stat-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

.stat-icon.danger {
  background: linear-gradient(135deg, rgba(196, 92, 74, 0.2) 0%, rgba(196, 92, 74, 0.08) 100%);
  color: #c45c4a;
  box-shadow: 0 4px 16px rgba(196, 92, 74, 0.12);
}

.stat-icon.gold {
  background: linear-gradient(135deg, rgba(228, 170, 79, 0.2) 0%, rgba(228, 170, 79, 0.08) 100%);
  color: #e4aa4f;
  box-shadow: 0 4px 16px rgba(228, 170, 79, 0.12);
}

.stat-icon.green {
  background: linear-gradient(135deg, rgba(102, 137, 113, 0.2) 0%, rgba(102, 137, 113, 0.08) 100%);
  color: #668971;
  box-shadow: 0 4px 16px rgba(102, 137, 113, 0.12);
}

.stat-icon.info {
  background: linear-gradient(135deg, rgba(98, 117, 141, 0.2) 0%, rgba(98, 117, 141, 0.08) 100%);
  color: #62758d;
  box-shadow: 0 4px 16px rgba(98, 117, 141, 0.12);
}

.stat-content {
  flex: 1;
  min-width: 0;
}

.stat-value {
  font-family: var(--font-mono);
  font-size: 1.875rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
  margin: 0 0 4px;
}

.stat-label {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ============================================
   DASHBOARD GRID
   ============================================ */

.dashboard-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.chart-card {
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .chart-card {
  background: #ffffff;
  border-color: #e5e7eb;
  backdrop-filter: none;
  box-shadow: var(--shadow-sm);
}

.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

[data-theme="light"] .chart-header {
  border-bottom-color: #e5e7eb;
}

.chart-header h3 {
  font-family: var(--font-ui);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin: 0;
  letter-spacing: -0.01em;
}

/* ============================================
   TREND CHART (vertical bar chart)
   ============================================ */

.chart-area {
  height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chart-bars {
  display: flex;
  align-items: flex-end;
  justify-content: space-around;
  gap: var(--space-sm);
  width: 100%;
  height: 280px;
  padding: 0 var(--space-xs);
}

.chart-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  justify-content: flex-end;
  gap: 6px;
  max-width: 80px;
}

.chart-bar-value {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--ro-gold);
}

.chart-bar {
  width: 100%;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  position: relative;
  transition: height 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

.chart-bar-fill {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, var(--ro-gold) 0%, rgba(228, 170, 79, 0.3) 100%);
  border-radius: inherit;
}

.chart-bar:hover .chart-bar-fill {
  filter: brightness(1.2);
}

.chart-bar-label {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: var(--text-muted);
  white-space: nowrap;
  text-align: center;
}

/* ============================================
   STATUS DONUT (conic-gradient)
   ============================================ */

.donut-area {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 260px;
}

.donut-chart-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
  width: 100%;
}

.donut-ring {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.3), inset 0 0 20px rgba(0, 0, 0, 0.2);
}

.donut-hole {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: #0a0c0b;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.4);
}

[data-theme="light"] .donut-hole {
  background: #ffffff;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.06);
}

.donut-total {
  font-family: var(--font-mono);
  font-size: 2rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}

.donut-total-label {
  font-family: var(--font-ui);
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 2px;
}

.donut-legend {
  display: flex;
  gap: var(--space-md);
  flex-wrap: wrap;
  justify-content: center;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.legend-text {
  font-family: var(--font-ui);
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.legend-count {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
}

/* ============================================
   TYPE BREAKDOWN (horizontal bars)
   ============================================ */

.type-breakdown {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  padding: var(--space-xs) 0;
}

.type-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.type-label {
  width: 100px;
  flex-shrink: 0;
}

.type-pill {
  display: inline-block;
  font-family: var(--font-ui);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 12px;
  white-space: nowrap;
}

.type-bar-track {
  flex: 1;
  height: 8px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 4px;
  overflow: hidden;
}

[data-theme="light"] .type-bar-track {
  background: #f3f4f6;
}

.type-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.type-count {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  min-width: 28px;
  text-align: right;
}

/* ============================================
   RECENT COMPLAINTS
   ============================================ */

.recent-list {
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
  overflow-y: auto;
  max-height: 520px;
}

[data-theme="light"] .recent-list {
  background: #ffffff;
  border-color: #e5e7eb;
  backdrop-filter: none;
  box-shadow: var(--shadow-sm);
}

.recent-header {
  font-family: var(--font-ui);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 var(--space-md);
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

[data-theme="light"] .recent-header {
  border-bottom-color: #e5e7eb;
}

.recent-item {
  padding: var(--space-sm);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}

.recent-item:last-child {
  margin-bottom: 0;
}

.recent-item:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.08);
  transform: translateX(3px);
}

[data-theme="light"] .recent-item {
  background: #f9fafb;
  border-color: #e5e7eb;
}

[data-theme="light"] .recent-item:hover {
  background: #f3f4f6;
  border-color: #d1d5db;
}

.recent-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  gap: 8px;
}

.recent-item-customer {
  font-family: var(--font-ui);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.recent-badge {
  font-family: var(--font-ui);
  font-size: 0.625rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.recent-badge.status-open {
  background: rgba(196, 92, 74, 0.15);
  color: #c45c4a;
}

.recent-badge.status-progress {
  background: rgba(228, 170, 79, 0.15);
  color: #e4aa4f;
}

.recent-badge.status-resolved {
  background: rgba(102, 137, 113, 0.15);
  color: #668971;
}

.recent-item-preview {
  font-family: var(--font-ui);
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ============================================
   COMPLAINTS LIST VIEW
   ============================================ */

#view-list {
  padding: var(--space-lg);
  overflow-y: auto;
}

.controls {
  display: flex;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
  flex-wrap: wrap;
  align-items: center;
}

.search-box {
  flex: 1;
  min-width: 240px;
  position: relative;
}

.search-input {
  width: 100%;
  padding: 12px 16px 12px 44px;
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 0.9375rem;
  transition: all 0.2s ease;
}

.search-input:focus {
  outline: none;
  border-color: var(--ro-gold);
  box-shadow: 0 0 0 3px rgba(228, 170, 79, 0.08);
  background: rgba(255, 255, 255, 0.05);
}

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

[data-theme="light"] .search-input {
  background: #ffffff;
  border-color: #e5e7eb;
  color: #111827;
}

[data-theme="light"] .search-input:focus {
  background: #ffffff;
}

.search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 1rem;
  pointer-events: none;
}

.filter-group {
  display: flex;
  gap: var(--space-xs);
  flex-wrap: wrap;
}

.filter-chip {
  padding: 10px 18px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
  font-family: var(--font-ui);
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

[data-theme="light"] .filter-chip {
  border-color: var(--border);
}

.filter-chip:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

.filter-chip.active {
  background: linear-gradient(135deg,
    rgba(228, 170, 79, 0.15) 0%,
    rgba(228, 170, 79, 0.06) 100%
  );
  color: var(--ro-gold);
  border-color: rgba(228, 170, 79, 0.3);
  box-shadow: 0 0 20px rgba(228, 170, 79, 0.12);
}

.complaints-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.complaint-card {
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  transition: all 0.3s ease;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

[data-theme="light"] .complaint-card {
  background: #ffffff;
  border-color: #e5e7eb;
  backdrop-filter: none;
}

.complaint-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  transition: all 0.3s ease;
}

.complaint-card.status-open::before {
  background: #c45c4a;
}

.complaint-card.status-progress::before {
  background: #e4aa4f;
}

.complaint-card.status-resolved::before {
  background: #668971;
}

.complaint-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
}

[data-theme="light"] .complaint-card:hover {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  border-color: #d1d5db;
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
}

.card-customer {
  font-family: var(--font-ui);
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 4px;
}

.card-badge {
  font-family: var(--font-ui);
  font-size: 0.625rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}

.card-badge.status-open {
  background: rgba(196, 92, 74, 0.15);
  color: #c45c4a;
  border: 1px solid rgba(196, 92, 74, 0.25);
}

.card-badge.status-progress {
  background: rgba(228, 170, 79, 0.15);
  color: #e4aa4f;
  border: 1px solid rgba(228, 170, 79, 0.25);
}

.card-badge.status-resolved {
  background: rgba(102, 137, 113, 0.15);
  color: #668971;
  border: 1px solid rgba(102, 137, 113, 0.25);
}

.card-meta {
  display: flex;
  gap: var(--space-sm);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: var(--space-sm);
  flex-wrap: wrap;
  align-items: center;
}

.card-meta span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.card-type-pill {
  font-family: var(--font-ui);
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
}

.card-complaint {
  font-family: var(--font-ui);
  font-size: 0.9375rem;
  color: var(--text-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ============================================
   NEW COMPLAINT FORM VIEW
   ============================================ */

#view-new {
  padding: var(--space-lg);
  overflow-y: auto;
}

.complaint-form {
  max-width: 900px;
  margin: 0 auto;
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .complaint-form {
  background: #ffffff;
  border-color: #e5e7eb;
  backdrop-filter: none;
  box-shadow: var(--shadow-md);
}

.form-section-title {
  font-family: var(--font-ui);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--ro-gold);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: var(--space-lg) 0 var(--space-md);
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

[data-theme="light"] .form-section-title {
  border-bottom-color: #e5e7eb;
}

.form-section-title:first-child {
  margin-top: 0;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}

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

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

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

.form-label {
  font-family: var(--font-ui);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 6px;
}

.form-input,
.form-select {
  padding: 12px 16px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 0.9375rem;
  transition: all 0.2s ease;
}

.form-input:focus,
.form-select:focus {
  outline: none;
  border-color: var(--ro-gold);
  box-shadow: 0 0 0 3px rgba(228, 170, 79, 0.08);
  background: rgba(0, 0, 0, 0.35);
}

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

.form-select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23ffffff44' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.form-select option {
  background: #0a0c0b;
  color: var(--text);
}

[data-theme="light"] .form-input,
[data-theme="light"] .form-select,
[data-theme="light"] .form-textarea {
  background: #ffffff;
  border-color: #e5e7eb;
  color: #111827;
}

[data-theme="light"] .form-input:focus,
[data-theme="light"] .form-select:focus,
[data-theme="light"] .form-textarea:focus {
  border-color: var(--ro-gold);
  box-shadow: 0 0 0 3px rgba(228, 170, 79, 0.1);
  background: #ffffff;
}

[data-theme="light"] .form-select option {
  background: #ffffff;
  color: #111827;
}

.form-textarea {
  padding: 12px 16px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 0.9375rem;
  resize: vertical;
  min-height: 120px;
  transition: all 0.2s ease;
}

.form-textarea:focus {
  outline: none;
  border-color: var(--ro-gold);
  box-shadow: 0 0 0 3px rgba(228, 170, 79, 0.08);
  background: rgba(0, 0, 0, 0.35);
}

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

.form-actions {
  display: flex;
  gap: var(--space-sm);
  justify-content: flex-end;
  margin-top: var(--space-lg);
  padding-top: var(--space-md);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

[data-theme="light"] .form-actions {
  border-top-color: #e5e7eb;
}

.form-submit,
.form-cancel {
  padding: 12px 28px;
  font-family: var(--font-ui);
  font-size: 0.9375rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 120px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.form-submit {
  background: linear-gradient(135deg, var(--ro-gold) 0%, #d89a3f 100%);
  color: #0a0c0b;
  box-shadow: 0 4px 16px rgba(228, 170, 79, 0.25);
}

.form-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(228, 170, 79, 0.35);
}

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

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

[data-theme="light"] .form-cancel {
  border-color: #e5e7eb;
}

.form-cancel:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

/* ============================================
   DETAIL MODAL
   ============================================ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: var(--space-md);
}

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

.modal-content {
  background: #0e100f;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-xl);
  max-width: 700px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);
  animation: modalSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

[data-theme="light"] .modal-content {
  background: #ffffff;
  border-color: #e5e7eb;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.15);
}

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

.modal-close {
  position: absolute;
  top: var(--space-md);
  right: var(--space-md);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
  font-size: 1.25rem;
  cursor: pointer;
  border-radius: 50%;
  transition: all 0.2s ease;
  z-index: 1;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  transform: rotate(90deg);
}

.modal-header {
  padding: var(--space-lg);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-md);
}

[data-theme="light"] .modal-header {
  border-bottom-color: #e5e7eb;
}

.modal-title {
  font-family: var(--font-ui);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 6px;
}

.modal-subtitle {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: var(--text-muted);
  margin: 0;
}

.modal-badge {
  font-family: var(--font-ui);
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 14px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}

.modal-badge.status-open {
  background: rgba(196, 92, 74, 0.15);
  color: #c45c4a;
  border: 1px solid rgba(196, 92, 74, 0.25);
}

.modal-badge.status-progress {
  background: rgba(228, 170, 79, 0.15);
  color: #e4aa4f;
  border: 1px solid rgba(228, 170, 79, 0.25);
}

.modal-badge.status-resolved {
  background: rgba(102, 137, 113, 0.15);
  color: #668971;
  border: 1px solid rgba(102, 137, 113, 0.25);
}

.detail-grid {
  padding: var(--space-lg);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
}

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

.detail-field.full {
  grid-column: 1 / -1;
}

.detail-label {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.detail-value {
  font-family: var(--font-ui);
  font-size: 0.9375rem;
  color: var(--text);
  line-height: 1.5;
  padding: 10px 14px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.04);
}

[data-theme="light"] .detail-value {
  background: #f9fafb;
  border-color: #e5e7eb;
}

.detail-value.large {
  font-size: 1rem;
  min-height: 80px;
  white-space: pre-wrap;
}

.modal-actions {
  padding: var(--space-md) var(--space-lg);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  gap: var(--space-sm);
  justify-content: flex-end;
}

[data-theme="light"] .modal-actions {
  border-top-color: #e5e7eb;
}

/* ============================================
   BUTTONS
   ============================================ */

.btn {
  padding: 10px 24px;
  font-family: var(--font-ui);
  font-size: 0.9375rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, var(--ro-green) 0%, #557d60 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(102, 137, 113, 0.2);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(102, 137, 113, 0.3);
}

.btn-danger {
  background: linear-gradient(135deg, #c45c4a 0%, #b04a3d 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(196, 92, 74, 0.2);
}

.btn-danger:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(196, 92, 74, 0.3);
}

.btn-gold {
  background: linear-gradient(135deg, var(--ro-gold) 0%, #d89a3f 100%);
  color: #0a0c0b;
  box-shadow: 0 4px 12px rgba(228, 170, 79, 0.2);
}

.btn-gold:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(228, 170, 79, 0.3);
}

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

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
}

[data-theme="light"] .btn-secondary {
  background: #f9fafb;
  border-color: #e5e7eb;
  color: #374151;
}

.btn:active {
  transform: translateY(0);
}

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

/* ============================================
   TOAST
   ============================================ */

.toast {
  position: fixed;
  bottom: var(--space-md);
  right: var(--space-md);
  background: #0e100f;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: var(--space-sm) var(--space-md);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 280px;
  max-width: 460px;
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 10000;
}

[data-theme="light"] .toast {
  background: #ffffff;
  border-color: #e5e7eb;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.toast i {
  font-size: 1.25rem;
  flex-shrink: 0;
}

.toast.success {
  border-left: 3px solid #668971;
}

.toast.success i {
  color: #668971;
}

.toast.error {
  border-left: 3px solid #c45c4a;
}

.toast.error i {
  color: #c45c4a;
}

.toast-message {
  font-family: var(--font-ui);
  font-size: 0.9375rem;
  color: var(--text);
  line-height: 1.4;
  flex: 1;
}

/* ============================================
   LOADING & EMPTY
   ============================================ */

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-xl);
  color: var(--text-muted);
}

.loading i {
  font-size: 2rem;
  animation: spin 1s linear infinite;
}

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

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

.empty-state i {
  font-size: 3.5rem;
  margin-bottom: var(--space-md);
  opacity: 0.2;
}

.empty-state p {
  font-family: var(--font-ui);
  font-size: 1rem;
  margin: 0;
  color: var(--text-secondary);
}

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

.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--ro-gold);
  color: #0a0c0b;
  padding: 8px 16px;
  text-decoration: none;
  font-family: var(--font-ui);
  font-weight: 600;
  border-radius: 0 0 var(--radius-sm) 0;
  z-index: 10001;
}

.skip-link:focus {
  top: 0;
}

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

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

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

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

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

  .detail-field.full {
    grid-column: 1;
  }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-260px);
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: 8px 0 32px rgba(0, 0, 0, 0.5);
  }

  .main {
    margin-left: 0;
  }

  .menu-btn {
    display: flex;
  }

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

  .header-title {
    font-size: 1.125rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .stats-row {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-sm);
  }

  .controls {
    flex-direction: column;
  }

  .search-box {
    min-width: 100%;
  }

  .filter-group {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
  }

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

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

  .form-submit,
  .form-cancel {
    width: 100%;
  }

  .modal-content {
    max-height: 95vh;
    border-radius: var(--radius-lg);
  }

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

  .toast {
    left: var(--space-sm);
    right: var(--space-sm);
    min-width: auto;
  }

  .donut-legend {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-xs);
  }

  .chart-bars {
    gap: var(--space-xs);
  }

  .type-label {
    width: 80px;
  }
}

@media (max-width: 480px) {
  #view-dashboard,
  #view-list,
  #view-new {
    padding: var(--space-sm);
  }

  .stats-row {
    grid-template-columns: 1fr;
  }

  .complaint-form {
    padding: var(--space-md);
  }

  .modal-content {
    border-radius: var(--radius-md);
  }

  .modal-header,
  .detail-grid {
    padding: var(--space-md);
  }

  .modal-actions {
    padding: var(--space-sm) var(--space-md);
    flex-wrap: wrap;
  }

  .stat-icon {
    width: 44px;
    height: 44px;
    font-size: 1.125rem;
  }

  .stat-value {
    font-size: 1.5rem;
  }

  .chart-bars {
    height: 200px;
  }

  .chart-area {
    height: 230px;
  }

  .donut-ring {
    width: 150px;
    height: 150px;
  }

  .donut-hole {
    width: 90px;
    height: 90px;
  }

  .donut-total {
    font-size: 1.5rem;
  }

  .view-nav {
    gap: 4px;
    padding: var(--space-xs) var(--space-sm);
  }

  .view-nav-btn {
    padding: 8px 14px;
    font-size: 0.8125rem;
  }
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
  .sidebar,
  .header,
  .view-nav,
  .controls,
  .form-actions,
  .modal-actions,
  .icon-btn,
  .btn {
    display: none !important;
  }

  .main {
    margin-left: 0;
  }

  .complaint-card,
  .modal-content {
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid #ccc;
  }
}
