/* ===== Agency Plus CRM — Design System ===== */

/* --- CSS Variables --- */
:root {
  --bg-primary: #0f0f1a;
  --bg-secondary: #1a1a2e;
  --bg-card: #16213e;
  --bg-card-hover: #1a2744;
  --bg-input: #0f0f1a;
  --bg-sidebar: #0d0d1a;
  --bg-glass: rgba(22, 33, 62, 0.7);

  --text-primary: #e8e8f0;
  --text-secondary: #8888aa;
  --text-muted: #555577;
  --text-heading: #ffffff;

  --accent-primary: #6c63ff;
  --accent-primary-hover: #5a52d9;
  --accent-secondary: #00d2ff;
  --accent-gradient: linear-gradient(135deg, #6c63ff, #00d2ff);
  --accent-gradient-hover: linear-gradient(135deg, #5a52d9, #00b8e6);

  --success: #00c853;
  --success-bg: rgba(0, 200, 83, 0.1);
  --warning: #ffa726;
  --warning-bg: rgba(255, 167, 38, 0.1);
  --danger: #ef5350;
  --danger-bg: rgba(239, 83, 80, 0.1);
  --info: #29b6f6;
  --info-bg: rgba(41, 182, 246, 0.1);

  --border-color: rgba(108, 99, 255, 0.15);
  --border-light: rgba(255, 255, 255, 0.06);

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 20px rgba(108, 99, 255, 0.15);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --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 {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent-primary);
  text-decoration: none;
  transition: var(--transition);
}

a:hover {
  color: var(--accent-secondary);
}

/* --- Typography --- */
h1,
h2,
h3,
h4,
h5,
h6 {
  color: var(--text-heading);
  font-weight: 700;
  line-height: 1.3;
}

h1 {
  font-size: 2rem;
}

h2 {
  font-size: 1.5rem;
}

h3 {
  font-size: 1.25rem;
}

/* --- Layout --- */
.app-layout {
  display: flex;
  min-height: 100vh;
}

.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 32px;
  min-height: 100vh;
  transition: var(--transition);
}

.full-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
  background: var(--bg-primary);
  position: relative;
  overflow: hidden;
}

.full-page::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 30% 50%, rgba(108, 99, 255, 0.08) 0%, transparent 50%),
    radial-gradient(circle at 70% 80%, rgba(0, 210, 255, 0.05) 0%, transparent 50%);
  animation: bgFloat 20s ease-in-out infinite;
}

@keyframes bgFloat {

  0%,
  100% {
    transform: translate(0, 0) rotate(0deg);
  }

  33% {
    transform: translate(2%, -2%) rotate(1deg);
  }

  66% {
    transform: translate(-1%, 1%) rotate(-1deg);
  }
}

/* --- Sidebar --- */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: var(--transition);
}

.sidebar-header {
  padding: 24px 20px;
  border-bottom: 1px solid var(--border-light);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-logo .logo-icon {
  width: 40px;
  height: 40px;
  background: var(--accent-gradient);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: 800;
  color: white;
  flex-shrink: 0;
}

.sidebar-logo h2 {
  font-size: 1.15rem;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.sidebar-logo .agency-name {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
  -webkit-text-fill-color: var(--text-muted);
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  overflow-y: auto;
}

.nav-section {
  margin-bottom: 24px;
}

.nav-section-title {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  padding: 0 12px;
  margin-bottom: 8px;
  font-weight: 600;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  transition: var(--transition);
  margin-bottom: 2px;
}

.nav-link:hover {
  background: rgba(108, 99, 255, 0.08);
  color: var(--text-primary);
}

.nav-link.active {
  background: rgba(108, 99, 255, 0.12);
  color: var(--accent-primary);
  box-shadow: var(--shadow-glow);
}

.nav-link svg,
.nav-link i {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  opacity: 0.7;
}

.nav-link.active svg,
.nav-link.active i {
  opacity: 1;
}

.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid var(--border-light);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.03);
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  color: white;
  flex-shrink: 0;
}

.user-details {
  flex: 1;
  min-width: 0;
}

.user-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* --- Page Header --- */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
  flex-wrap: wrap;
  gap: 16px;
}

.page-header h1 {
  font-size: 1.75rem;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* --- Cards --- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 24px;
  transition: var(--transition);
}

.card:hover {
  border-color: rgba(108, 99, 255, 0.25);
  box-shadow: var(--shadow-glow);
}

.card-glass {
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 24px;
}

/* --- Stats Grid --- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 24px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.stat-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent-gradient);
  opacity: 0;
  transition: var(--transition);
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-card:hover::after {
  opacity: 1;
}

.stat-card .stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  font-size: 1.4rem;
}

.stat-card .stat-icon.blue {
  background: var(--info-bg);
  color: var(--info);
}

.stat-card .stat-icon.green {
  background: var(--success-bg);
  color: var(--success);
}

.stat-card .stat-icon.orange {
  background: var(--warning-bg);
  color: var(--warning);
}

.stat-card .stat-icon.red {
  background: var(--danger-bg);
  color: var(--danger);
}

.stat-card .stat-icon.purple {
  background: rgba(108, 99, 255, 0.1);
  color: var(--accent-primary);
}

.stat-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-heading);
  line-height: 1.1;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 500;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  font-family: inherit;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent-gradient);
  color: white;
  box-shadow: 0 4px 15px rgba(108, 99, 255, 0.3);
}

.btn-primary:hover {
  background: var(--accent-gradient-hover);
  box-shadow: 0 6px 20px rgba(108, 99, 255, 0.4);
  transform: translateY(-1px);
  color: white;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-heading);
}

.btn-success {
  background: var(--success);
  color: white;
}

.btn-success:hover {
  background: #00b348;
  color: white;
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-danger:hover {
  background: #d32f2f;
  color: white;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.78rem;
}

.btn-icon {
  padding: 8px;
  min-width: 36px;
  justify-content: center;
}

.btn-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* --- Forms --- */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
  letter-spacing: 0.3px;
}

.form-control {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: inherit;
  transition: var(--transition);
  outline: none;
}

.form-control:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.15);
}

.form-control::placeholder {
  color: var(--text-muted);
}

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238888aa' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

textarea.form-control {
  min-height: 100px;
  resize: vertical;
}

.form-row, .grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
}

.role-entry {
  display: flex !important;
  grid-template-columns: unset !important;
  gap: 12px;
  align-items: flex-end;
  margin-bottom: 12px;
}

.role-entry .form-group {
  margin-bottom: 0;
}

.role-entry .form-group:nth-child(1) {
  flex: 2;
  min-width: 0;
}

.role-entry .form-group:nth-child(2) {
  flex: 1;
  min-width: 0;
}

.role-entry .form-group:nth-child(3) {
  flex: 0 0 auto;
}

.role-entry .btn-error {
  height: 44px;
  width: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: var(--radius-sm);
  background: rgba(239, 83, 80, 0.15);
  color: var(--danger);
  border: 1px solid rgba(239, 83, 80, 0.25);
  font-size: 0.9rem;
  cursor: pointer;
  transition: var(--transition);
}

.role-entry .btn-error:hover {
  background: rgba(239, 83, 80, 0.3);
}

.form-card {
  max-width: 640px;
  margin: 0 auto;
}

/* --- Tables --- */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.table thead {
  background: rgba(108, 99, 255, 0.06);
}

.table th {
  padding: 14px 16px;
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  white-space: nowrap;
  border-bottom: 1px solid var(--border-color);
}

.table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-primary);
}

.table tr:last-child td {
  border-bottom: none;
}

.table tr:hover td {
  background: rgba(108, 99, 255, 0.03);
}

.table .actions {
  display: flex;
  gap: 6px;
}

/* --- Badges --- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-pending {
  background: var(--warning-bg);
  color: var(--warning);
  border: 1px solid rgba(255, 167, 38, 0.2);
}

.badge-progress {
  background: var(--info-bg);
  color: var(--info);
  border: 1px solid rgba(41, 182, 246, 0.2);
}

.badge-completed {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid rgba(0, 200, 83, 0.2);
}

.badge-received {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid rgba(0, 200, 83, 0.2);
}

.badge-not-received {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid rgba(239, 83, 80, 0.2);
}

/* --- Alerts / Flash Messages --- */
.alert {
  padding: 14px 20px;
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
  font-size: 0.875rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.alert-success {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid rgba(0, 200, 83, 0.2);
}

.alert-error {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid rgba(239, 83, 80, 0.2);
}

/* --- Auth Pages --- */
.auth-container {
  width: 100%;
  max-width: 440px;
  position: relative;
  z-index: 1;
}

.auth-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: 40px;
  box-shadow: var(--shadow-lg);
}

.auth-header {
  text-align: center;
  margin-bottom: 32px;
}

.auth-logo {
  width: 56px;
  height: 56px;
  background: var(--accent-gradient);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  font-size: 1.5rem;
  font-weight: 800;
  color: white;
}

.auth-header h1 {
  font-size: 1.5rem;
  margin-bottom: 6px;
}

.auth-header p {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.auth-card .btn-primary {
  width: 100%;
  padding: 14px;
  font-size: 1rem;
  justify-content: center;
}

.auth-footer {
  text-align: center;
  margin-top: 20px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.auth-links {
  text-align: center;
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--border-light);
}

.auth-links a {
  display: inline-block;
  margin: 4px 8px;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.auth-links a:hover {
  color: var(--accent-primary);
}

/* --- Filters Bar --- */
.filters-bar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: end;
  margin-bottom: 24px;
  padding: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.filters-bar .form-group {
  margin-bottom: 0;
  flex: 1;
  min-width: 150px;
}

.filters-bar .form-group label {
  font-size: 0.72rem;
  margin-bottom: 4px;
}

.filters-bar .form-control {
  padding: 8px 12px;
  font-size: 0.82rem;
}

.filters-bar .btn {
  align-self: flex-end;
}

/* --- Today's Tasks Widget --- */
.today-widget {
  margin-bottom: 32px;
}

.today-widget .widget-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.today-widget .widget-header h2 {
  font-size: 1.15rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.today-widget .widget-header .date-badge {
  font-size: 0.75rem;
  background: var(--accent-gradient);
  padding: 4px 12px;
  border-radius: 20px;
  color: white;
  font-weight: 600;
}

.task-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.task-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.task-item:hover {
  border-color: rgba(108, 99, 255, 0.25);
  transform: translateX(4px);
}

.task-item .task-info {
  flex: 1;
  min-width: 0;
}

.task-item .task-title {
  font-weight: 600;
  color: var(--text-heading);
  margin-bottom: 2px;
}

.task-item .task-meta {
  font-size: 0.78rem;
  color: var(--text-secondary);
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
}

.empty-state .empty-icon {
  font-size: 3rem;
  margin-bottom: 16px;
  opacity: 0.3;
}

.empty-state h3 {
  color: var(--text-secondary);
  margin-bottom: 8px;
  font-size: 1.1rem;
}

.empty-state p {
  font-size: 0.9rem;
  max-width: 400px;
  margin: 0 auto;
}

/* --- Payment Summary --- */
.payment-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.payment-summary .summary-card {
  padding: 20px;
  border-radius: var(--radius-sm);
  text-align: center;
}

.payment-summary .summary-card.received {
  background: var(--success-bg);
  border: 1px solid rgba(0, 200, 83, 0.15);
}

.payment-summary .summary-card.pending {
  background: var(--warning-bg);
  border: 1px solid rgba(255, 167, 38, 0.15);
}

.payment-summary .summary-value {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-heading);
}

.payment-summary .summary-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 4px;
}

/* --- Section Headers --- */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-header h2 {
  font-size: 1.15rem;
}

/* --- Grid Layouts --- */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 24px;
}

/* --- Mobile Sidebar Toggle --- */
.sidebar-toggle {
  display: none;
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 200;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  font-size: 1.2rem;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 90;
}

/* --- Client Detail --- */
.detail-header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 32px;
}

.detail-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.detail-info h1 {
  font-size: 1.5rem;
  margin-bottom: 4px;
}

.detail-info p {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.info-item {
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
}

.info-item .info-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.info-item .info-value {
  font-weight: 600;
  color: var(--text-primary);
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-toggle {
    display: flex;
  }

  .sidebar-overlay.show {
    display: block;
  }

  .main-content {
    margin-left: 0;
    padding: 20px;
    padding-top: 72px;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
  }

  .stat-value {
    font-size: 1.5rem;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .filters-bar {
    flex-direction: column;
  }

  .filters-bar .form-group {
    min-width: 100%;
  }

  .grid-2 {
    grid-template-columns: 1fr;
  }

  .table th,
  .table td {
    padding: 10px 12px;
    font-size: 0.8rem;
  }

  .auth-card {
    padding: 28px 24px;
  }

  .detail-header {
    flex-direction: column;
    text-align: center;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }

  .stat-card {
    padding: 16px;
  }

  .main-content {
    padding: 16px;
    padding-top: 72px;
  }
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(108, 99, 255, 0.3);
}

/* --- Utilities --- */
.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.mt-1 {
  margin-top: 8px;
}

.mt-2 {
  margin-top: 16px;
}

.mt-3 {
  margin-top: 24px;
}

.mb-1 {
  margin-bottom: 8px;
}

.mb-2 {
  margin-bottom: 16px;
}

.mb-3 {
  margin-bottom: 24px;
}

.flex {
  display: flex;
}

.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.gap-1 {
  gap: 8px;
}

.gap-2 {
  gap: 16px;
}

/* --- Custom Confirmation Modal --- */
.confirm-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(5px);
  z-index: 10000;
  align-items: center;
  justify-content: center;
}

.confirm-modal.show {
  display: flex;
}

.confirm-content {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 32px;
  max-width: 400px;
  width: 90%;
  text-align: center;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalIn {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.confirm-icon {
  font-size: 3rem;
  color: var(--danger);
  margin-bottom: 16px;
}

.confirm-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text-heading);
}

.confirm-message {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 24px;
}

.confirm-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.confirm-actions .btn {
  min-width: 100px;
}

/* ===== Light Mode Theme Overrides ===== */
body.light-mode {
  --bg-primary: #f8f9fa;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f3f5;
  --bg-input: #ffffff;
  --bg-sidebar: #ffffff;
  --bg-glass: rgba(255, 255, 255, 0.85);

  --text-primary: #343a40;
  --text-secondary: #495057;
  --text-muted: #6c757d;
  --text-heading: #212529;

  --border-color: rgba(0, 0, 0, 0.1);
  --border-light: rgba(0, 0, 0, 0.05);

  --shadow-glow: 0 0 20px rgba(108, 99, 255, 0.2);
}

body.light-mode .card,
body.light-mode .stat-card,
body.light-mode .auth-card {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
}

body.light-mode .sidebar {
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.02);
}

body.light-mode .sidebar-logo h2 {
  -webkit-text-fill-color: transparent;
}

body.light-mode .nav-link {
  color: var(--text-secondary);
}

body.light-mode .nav-link:hover {
  background: rgba(108, 99, 255, 0.05);
  color: var(--accent-primary);
}

body.light-mode .nav-link.active {
  background: rgba(108, 99, 255, 0.08);
  font-weight: 600;
}

body.light-mode .table thead {
  background: rgba(0, 0, 0, 0.02);
}

body.light-mode .table tr:hover td {
  background: rgba(0, 0, 0, 0.015);
}

body.light-mode .form-control {
  background: #fdfdfd;
  color: #333;
}

body.light-mode .form-control:focus {
  background: #ffffff;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.1);
}

body.light-mode .btn-secondary {
  background: rgba(0, 0, 0, 0.03);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

body.light-mode .btn-secondary:hover {
  background: rgba(0, 0, 0, 0.06);
  color: var(--text-heading);
}

body.light-mode .badge {
  background: #f1f3f5;
  color: #495057;
  border: 1px solid var(--border-color);
}
body.light-mode .badge.badge-completed,
body.light-mode .badge.badge-received {
  background: rgba(0, 200, 83, 0.1);
  color: #009624;
  border-color: rgba(0, 200, 83, 0.2);
}
body.light-mode .badge.badge-pending {
  background: rgba(255, 167, 38, 0.15);
  color: #e65100;
  border-color: rgba(255, 167, 38, 0.3);
}
body.light-mode .badge.badge-not-received,
body.light-mode .badge.badge-danger {
  background: rgba(239, 83, 80, 0.1);
  color: #c62828;
  border-color: rgba(239, 83, 80, 0.2);
}

body.light-mode .user-info {
  background: rgba(0, 0, 0, 0.03);
}

body.light-mode .full-page::before {
  background: radial-gradient(circle at 30% 50%, rgba(108, 99, 255, 0.04) 0%, transparent 50%),
    radial-gradient(circle at 70% 80%, rgba(0, 210, 255, 0.03) 0%, transparent 50%);
}