/* ============================================
   DaGrana - Design System
   Premium dark theme with glassmorphism
   ============================================ */

:root {
  --bg-primary: #0a0a1a;
  --bg-secondary: #111127;
  --bg-tertiary: #1a1a3e;
  --bg-glass: rgba(20, 20, 60, 0.6);
  --bg-glass-hover: rgba(30, 30, 80, 0.7);
  --bg-card: #13132e;

  --text-primary: #f0f0ff;
  --text-secondary: #a0a0cc;
  --text-muted: #6b6b99;

  --accent-green: #00d68f;
  --accent-green-glow: rgba(0, 214, 143, 0.3);
  --accent-red: #ff4d6a;
  --accent-red-glow: rgba(255, 77, 106, 0.3);
  --accent-blue: #5b8cff;
  --accent-blue-glow: rgba(91, 140, 255, 0.3);
  --accent-purple: #8b5cf6;
  --accent-purple-glow: rgba(139, 92, 246, 0.3);
  --accent-gold: #fbbf24;
  --accent-gold-glow: rgba(251, 191, 36, 0.3);

  --gradient-primary: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a855f7 100%);
  --gradient-income: linear-gradient(135deg, #00d68f 0%, #10b981 100%);
  --gradient-expense: linear-gradient(135deg, #ff4d6a 0%, #ef4444 100%);
  --gradient-balance: linear-gradient(135deg, #5b8cff 0%, #3b82f6 100%);
  --gradient-business: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);

  --border-color: rgba(100, 100, 200, 0.15);
  --border-color-hover: rgba(100, 100, 200, 0.3);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);

  --sidebar-width: 260px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  display: flex;
  min-height: 100vh;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 30% 40%, rgba(99, 102, 241, 0.08) 0%, transparent 50%),
    radial-gradient(circle at 70% 60%, rgba(139, 92, 246, 0.06) 0%, transparent 50%);
  z-index: -1;
  animation: bgShift 20s ease-in-out infinite alternate;
}

@keyframes bgShift {
  0% {
    transform: translate(0, 0) rotate(0deg);
  }

  100% {
    transform: translate(-5%, -3%) rotate(5deg);
  }
}

/* ============================================
   Scrollbar
   ============================================ */
::-webkit-scrollbar {
  width: 6px;
}

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

::-webkit-scrollbar-thumb {
  background: rgba(100, 100, 200, 0.3);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(100, 100, 200, 0.5);
}

/* ============================================
   Sidebar
   ============================================ */
.sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  position: fixed;
  left: 0;
  top: 0;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: var(--transition);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px 20px;
  border-bottom: 1px solid var(--border-color);
}

.brand-icon {
  font-size: 32px;
  animation: coinBounce 3s ease-in-out infinite;
}

@keyframes coinBounce {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-4px);
  }
}

.brand-name {
  font-size: 1.5rem;
  font-weight: 800;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.5px;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.9rem;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.nav-item:hover {
  color: var(--text-primary);
  background: var(--bg-glass);
}

.nav-item.active {
  color: var(--text-primary);
  background: var(--bg-glass);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: var(--gradient-primary);
  border-radius: 0 3px 3px 0;
}

.nav-icon {
  font-size: 1.2rem;
}

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

.month-selector label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
}

.month-selector input[type="month"] {
  width: 100%;
  padding: 8px 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
}

/* ============================================
   Main Content
   ============================================ */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  padding: 32px;
  min-height: 100vh;
}

.mobile-header {
  display: none;
  align-items: center;
  gap: 12px;
  padding: 16px 0;
  margin-bottom: 16px;
}

.menu-toggle {
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-size: 1.2rem;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.brand-icon-small {
  font-size: 24px;
}

.brand-name-small {
  font-weight: 700;
  font-size: 1.1rem;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ============================================
   Page Structure
   ============================================ */
.page {
  display: none;
  animation: fadeIn 0.4s ease;
}

.page.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 12px;
}

.page-title {
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.page-subtitle {
  font-size: 0.95rem;
  color: var(--text-secondary);
}

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

/* ============================================
   Glass Card
   ============================================ */
.glass-card {
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 20px;
  transition: var(--transition);
}

.glass-card:hover {
  border-color: var(--border-color-hover);
}

/* ============================================
   Summary Cards
   ============================================ */
.summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.summary-card {
  position: relative;
  overflow: hidden;
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: var(--transition);
}

.summary-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-color-hover);
}

.card-glow {
  position: absolute;
  top: -50%;
  right: -30%;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  filter: blur(40px);
  opacity: 0.5;
  transition: var(--transition);
}

.summary-card:hover .card-glow {
  opacity: 0.8;
}

.summary-card.income .card-glow {
  background: var(--accent-green);
}

.summary-card.expense .card-glow {
  background: var(--accent-red);
}

.summary-card.balance .card-glow {
  background: var(--accent-blue);
}

.summary-card.business .card-glow {
  background: var(--accent-gold);
}

.card-icon {
  font-size: 2rem;
}

.card-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 1;
}

.card-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
}

.card-value {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.summary-card.income .card-value {
  color: var(--accent-green);
}

.summary-card.expense .card-value {
  color: var(--accent-red);
}

.summary-card.balance .card-value {
  color: var(--accent-blue);
}

.summary-card.business .card-value {
  color: var(--accent-gold);
}

/* ============================================
   Charts
   ============================================ */
.charts-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 20px;
  margin-bottom: 20px;
}

.chart-container {
  min-height: 300px;
}

.chart-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text-secondary);
}

/* ============================================
   Data Table
   ============================================ */
.table-container {
  overflow-x: auto;
}

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

.data-table th {
  text-align: left;
  padding: 12px 16px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  font-weight: 600;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.data-table td {
  padding: 14px 16px;
  font-size: 0.9rem;
  border-bottom: 1px solid rgba(100, 100, 200, 0.07);
  vertical-align: middle;
}

.data-table tbody tr {
  transition: var(--transition);
}

.data-table tbody tr:hover {
  background: var(--bg-glass-hover);
}

.text-right {
  text-align: right;
}

.amount-expense {
  color: var(--accent-red);
  font-weight: 600;
}

.amount-income {
  color: var(--accent-green);
  font-weight: 600;
}

.amount-investment {
  color: var(--accent-purple);
  font-weight: 600;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-expense {
  background: rgba(255, 77, 106, 0.15);
  color: var(--accent-red);
}

.badge-income {
  background: rgba(0, 214, 143, 0.15);
  color: var(--accent-green);
}

.badge-investment {
  background: rgba(139, 92, 246, 0.15);
  color: var(--accent-purple);
}

.badge-business {
  background: rgba(251, 191, 36, 0.15);
  color: var(--accent-gold);
}

.badge-category {
  background: rgba(100, 100, 200, 0.15);
  color: var(--text-secondary);
}

.installment-tag {
  font-size: 0.7rem;
  color: var(--text-muted);
  background: rgba(100, 100, 200, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 6px;
}

/* ============================================
   Upload Area
   ============================================ */
.upload-zone {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-lg);
  padding: 48px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}

.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--accent-purple);
  background: rgba(139, 92, 246, 0.05);
}

.upload-zone.dragover {
  animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.01);
  }
}

.upload-icon {
  font-size: 3rem;
  margin-bottom: 16px;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-8px);
  }
}

.upload-zone h3 {
  font-size: 1.2rem;
  margin-bottom: 8px;
}

.upload-zone p {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.upload-hint {
  font-size: 0.8rem !important;
  color: var(--text-muted) !important;
  margin-top: 8px;
}

/* Import Page */
.import-drop-zone {
  border: 2px dashed rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 40px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  background: transparent;
}

.import-drop-zone:hover {
  border-color: var(--accent-primary);
  background: rgba(99, 102, 241, 0.05);
}

.transactions-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.transactions-table th {
  text-align: left;
  padding: 12px;
  color: var(--text-muted);
  font-weight: 500;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.transactions-table td {
  padding: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.badge-income {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
}

.badge-expense {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

/* Chat Character Animations */
.chat-character {
  width: 40px;
  height: 40px;
  margin-right: 8px;
}

#walletChar {
  /* Default idle animation */
  animation: charBounce 2s infinite ease-in-out;
  transform-origin: bottom center;
}

.char-eye {
  animation: charBlink 4s infinite;
  transform-origin: center;
}

/* States */
.chat-character.thinking #walletChar {
  animation: charBounce 0.5s infinite alternate;
  opacity: 0.8;
}

.chat-character.happy #walletChar {
  animation: charBounce 0.3s 2 alternate;
  /* Jump twice */
  stroke: #22c55e;
}

.chat-character.happy .char-mouth {
  d: path("M35 65 Q50 75 65 65");
  /* Bigger smile */
}

.chat-character.error #walletChar {
  animation: charShake 0.4s 2;
}

.chat-character.error rect {
  fill: #ef4444;
}

/* Keyframes */
@keyframes charBounce {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-3px);
  }
}

@keyframes charBlink {

  0%,
  48%,
  52%,
  100% {
    transform: scaleY(1);
  }

  50% {
    transform: scaleY(0.1);
  }
}

@keyframes charShake {

  0%,
  100% {
    transform: translateX(0);
  }

  25% {
    transform: translateX(-5px);
  }

  75% {
    transform: translateX(5px);
  }
}



.upload-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
}

/* Upload Queue */
.upload-queue-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(100, 100, 200, 0.07);
}

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

.queue-status {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.queue-status.pending {
  background: rgba(100, 100, 200, 0.2);
}

.queue-status.processing {
  background: rgba(91, 140, 255, 0.2);
  animation: spin 1.5s linear infinite;
}

.queue-status.done {
  background: rgba(0, 214, 143, 0.2);
}

.queue-status.error {
  background: rgba(255, 77, 106, 0.2);
}

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

  to {
    transform: rotate(360deg);
  }
}

.queue-info {
  flex: 1;
}

.queue-filename {
  font-weight: 600;
  font-size: 0.9rem;
}

.queue-detail {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Invoice list */
.invoice-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid rgba(100, 100, 200, 0.07);
}

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

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

.invoice-status-dot.pending {
  background: var(--accent-gold);
}

.invoice-status-dot.processing {
  background: var(--accent-blue);
  animation: blink 1s ease-in-out infinite;
}

.invoice-status-dot.done {
  background: var(--accent-green);
}

.invoice-status-dot.error {
  background: var(--accent-red);
}

@keyframes blink {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.3;
  }
}

.invoice-info {
  flex: 1;
}

.invoice-name {
  font-weight: 600;
  font-size: 0.9rem;
}

.invoice-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ============================================
   Filters
   ============================================ */
.filters {
  padding: 16px 20px;
}

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

.filter-input {
  min-width: 160px;
  flex: 1;
}

/* ============================================
   Forms
   ============================================ */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.form-group label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-input {
  padding: 10px 14px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  transition: var(--transition);
  width: 100%;
}

.form-input:focus {
  outline: none;
  border-color: var(--accent-purple);
  box-shadow: 0 0 0 3px var(--accent-purple-glow);
}

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

.form-color {
  height: 42px;
  padding: 4px;
  cursor: pointer;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.checkbox-label {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.9rem !important;
  text-transform: none !important;
  letter-spacing: normal !important;
  color: var(--text-primary) !important;
  padding-top: 20px;
}

.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent-purple);
}

/* ============================================
   Buttons
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.btn-primary {
  background: var(--gradient-primary);
  color: white;
  box-shadow: 0 4px 15px var(--accent-purple-glow);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px var(--accent-purple-glow);
}

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

.btn-ghost:hover {
  background: var(--bg-glass);
  color: var(--text-primary);
}

.btn-danger {
  background: rgba(255, 77, 106, 0.15);
  color: var(--accent-red);
}

.btn-danger:hover {
  background: rgba(255, 77, 106, 0.3);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}

.btn-icon {
  padding: 6px 8px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

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

/* ============================================
   Modals
   ============================================ */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal-overlay.active {
  display: flex;
  animation: fadeIn 0.2s ease;
}

.modal {
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

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

.modal-header h3 {
  font-size: 1.2rem;
  font-weight: 700;
}

.btn-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.btn-close:hover {
  background: var(--bg-glass);
  color: var(--text-primary);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
}

/* ============================================
   Reports
   ============================================ */
.report-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 20px;
  margin-bottom: 20px;
}

.report-block h4 {
  font-size: 1rem;
  margin-bottom: 16px;
  color: var(--text-secondary);
}

.report-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.report-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.report-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.report-value {
  font-size: 1.2rem;
  font-weight: 700;
}

/* Category breakdown */
.category-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(100, 100, 200, 0.07);
}

.category-bar:last-child {
  border-bottom: none;
}

.category-icon {
  font-size: 1.3rem;
  width: 32px;
  text-align: center;
}

.category-name {
  flex: 1;
  font-weight: 500;
  font-size: 0.9rem;
}

.category-count {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.category-amount {
  font-weight: 700;
  font-size: 0.95rem;
  min-width: 100px;
  text-align: right;
}

.category-progress {
  width: 120px;
  height: 6px;
  background: rgba(100, 100, 200, 0.1);
  border-radius: 3px;
  overflow: hidden;
}

.category-progress-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--gradient-primary);
  transition: width 0.8s ease;
}

/* ============================================
   Cards Grid
   ============================================ */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.credit-card {
  position: relative;
  height: 200px;
  border-radius: var(--radius-xl);
  padding: 28px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  cursor: pointer;
  transition: var(--transition);
}

.credit-card:hover {
  transform: translateY(-6px) scale(1.02);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

.credit-card::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -30%;
  width: 200px;
  height: 200px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
}

.credit-card::after {
  content: '';
  position: absolute;
  bottom: -40%;
  left: -20%;
  width: 150px;
  height: 150px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 50%;
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  z-index: 1;
}

.card-bank {
  font-size: 1.1rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.95);
}

.card-brand-label {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.7);
  font-weight: 500;
}

.card-bottom {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  z-index: 1;
}

.card-digits {
  font-size: 1.1rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
  letter-spacing: 2px;
}

.card-type {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.6);
}

.card-delete-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  opacity: 0;
  transition: var(--transition);
}

.credit-card:hover .card-delete-btn {
  opacity: 1;
}

/* ============================================
   Empty State
   ============================================ */
.empty-state {
  text-align: center;
  padding: 40px 20px;
}

.empty-icon {
  font-size: 3rem;
  display: block;
  margin-bottom: 12px;
}

.empty-state p {
  color: var(--text-muted);
  margin-bottom: 16px;
}

/* ============================================
   Section Header
   ============================================ */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.section-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-secondary);
}

/* ============================================
   Toast Notifications
   ============================================ */
.toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 280px;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.3s ease;
  font-size: 0.9rem;
}

.toast.toast-out {
  animation: toastOut 0.3s ease forwards;
}

.toast-success {
  border-left: 3px solid var(--accent-green);
}

.toast-error {
  border-left: 3px solid var(--accent-red);
}

.toast-info {
  border-left: 3px solid var(--accent-blue);
}

@keyframes toastIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }

  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes toastOut {
  from {
    transform: translateX(0);
    opacity: 1;
  }

  to {
    transform: translateX(100%);
    opacity: 0;
  }
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

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

  .main-content {
    margin-left: 0;
    padding: 16px;
  }

  .mobile-header {
    display: flex;
  }

  .summary-cards {
    grid-template-columns: 1fr 1fr;
  }

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

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

  .upload-options {
    grid-template-columns: 1fr;
  }

  .filter-group {
    flex-direction: column;
  }

  .report-summary {
    grid-template-columns: 1fr;
  }

  .data-table {
    font-size: 0.8rem;
  }

  .data-table th,
  .data-table td {
    padding: 10px 8px;
  }
}

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

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

  .category-progress {
    display: none;
  }
}

/* ============================================
   Loading Spinner
   ============================================ */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(100, 100, 200, 0.2);
  border-top-color: var(--accent-purple);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}

/* Select styling */
select.form-input {
  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='%236b6b99' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

select.form-input option {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

/* ============================================
   PF/PJ Mode Toggle
   ============================================ */
.mode-toggle {
  display: flex;
  gap: 4px;
  padding: 8px 12px 0;
  margin-bottom: 4px;
}

.mode-btn {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  background: transparent;
  color: var(--text-muted);
  font-family: 'Inter', sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.mode-btn:hover {
  background: var(--bg-glass);
  color: var(--text-primary);
}

.mode-btn.active {
  background: var(--gradient-primary);
  color: white;
  border-color: transparent;
  box-shadow: 0 2px 10px var(--accent-purple-glow);
}

/* Employee Summary Row (PJ) */
.employee-summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid rgba(100, 100, 200, 0.07);
}

.employee-summary-row:last-child {
  border-bottom: none;
}

.employee-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.employee-avatar {
  width: 40px;
  height: 40px;
  background: var(--gradient-primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  color: white;
}

.employee-name {
  font-weight: 600;
  font-size: 0.95rem;
}

.employee-count {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.employee-total {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent-red);
}

/* Category inline select */
.category-select {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid rgba(100, 100, 200, 0.15);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 0.82rem;
  cursor: pointer;
  max-width: 180px;
  transition: border-color 0.2s;
}

.category-select:hover {
  border-color: var(--accent-primary);
}

.category-select:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

/* Agenda tabs */
.agenda-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
}

.agenda-tab {
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid rgba(100, 100, 200, 0.12);
  border-radius: 8px;
  padding: 8px 18px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.agenda-tab:hover {
  border-color: var(--accent-primary);
}

.agenda-tab.active {
  background: var(--accent-primary);
  color: white;
  border-color: var(--accent-primary);
}

.agenda-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.agenda-card {
  padding: 20px;
}

/* Chat FAB */
.chat-fab {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-primary), #818cf8);
  color: white;
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 24px rgba(99, 102, 241, 0.4);
  z-index: 1000;
  transition: transform 0.2s, box-shadow 0.2s;
}

.chat-fab:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 32px rgba(99, 102, 241, 0.5);
}

/* Chat panel */
.chat-panel {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 380px;
  height: 520px;
  background: var(--bg-card);
  border: 1px solid rgba(100, 100, 200, 0.15);
  border-radius: 16px;
  flex-direction: column;
  overflow: hidden;
  z-index: 1001;
  box-shadow: 0 8px 48px rgba(0, 0, 0, 0.4);
  animation: chatSlideUp 0.3s ease;
}

/* ============================================
   Mobile Optimizations
   ============================================ */
.table-container {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 480px) {
  .chat-panel {
    width: 90vw;
    right: 5vw;
    bottom: 20px;
    height: 70vh;
  }

  .import-drop-zone {
    padding: 24px 16px;
  }

  .page-header h2 {
    font-size: 1.4rem;
  }
}

@keyframes chatSlideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: linear-gradient(135deg, var(--accent-primary), #818cf8);
  color: white;
  font-weight: 600;
  font-size: 0.95rem;
}

.chat-header .btn-icon {
  background: none;
  border: none;
  color: white;
  font-size: 1rem;
  cursor: pointer;
  padding: 4px 8px;
  opacity: 0.8;
  transition: opacity 0.2s;
}

.chat-header .btn-icon:hover {
  opacity: 1;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 0.88rem;
  line-height: 1.5;
}

.chat-msg p {
  margin: 0;
}

.chat-msg.user {
  align-self: flex-end;
  background: var(--accent-primary);
  color: white;
  border-bottom-right-radius: 4px;
}

.chat-msg.assistant {
  align-self: flex-start;
  background: rgba(100, 100, 200, 0.08);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
}

.chat-msg.typing {
  opacity: 0.7;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 0.7;
  }

  50% {
    opacity: 0.4;
  }
}

.chat-msg code {
  background: rgba(100, 100, 200, 0.15);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 0.82rem;
}

.chat-input {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid rgba(100, 100, 200, 0.1);
}

.chat-input input {
  flex: 1;
  background: var(--bg-body);
  border: 1px solid rgba(100, 100, 200, 0.15);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--text-primary);
  font-size: 0.88rem;
  outline: none;
}

.chat-input input:focus {
  border-color: var(--accent-primary);
}

.chat-input .btn {
  padding: 8px 14px;
  font-size: 1rem;
  min-width: auto;
}

@media (max-width: 480px) {
  .chat-panel {
    width: calc(100vw - 24px);
    height: calc(100vh - 120px);
    bottom: 12px;
    right: 12px;
  }
}