:root {
  --primary: #1a6b4a;
  --primary-light: #2ecc71;
  --primary-dark: #0d4a33;
  --accent: #f0b429;
  --accent-dark: #d4950a;
  --danger: #e74c3c;
  --bg: #0a1628;
  --bg2: #0f2040;
  --bg3: #162a4a;
  --card: rgba(255, 255, 255, 0.04);
  --card-border: rgba(255, 255, 255, 0.08);
  --text: #e8f4f0;
  --text-muted: #8aa8b8;
  --radius: 16px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

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

body {
  font-family: 'Cairo', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Background */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 20% 0%, rgba(26, 107, 74, 0.25) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 80% 100%, rgba(240, 180, 41, 0.1) 0%, transparent 60%),
    radial-gradient(ellipse 40% 40% at 50% 50%, rgba(15, 32, 64, 0.8) 0%, transparent 100%);
  pointer-events: none;
  z-index: 0;
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 16px;
  position: relative;
  z-index: 1;
}

/* Header */
header {
  text-align: center;
  padding: 40px 0 32px;
  position: relative;
}

header::after {
  content: '';
  display: block;
  width: 80px;
  height: 3px;
  background: linear-gradient(90deg, var(--primary-light), var(--accent));
  margin: 16px auto 0;
  border-radius: 2px;
}

.logo-icon {
  font-size: 48px;
  margin-bottom: 8px;
  display: block;
  filter: drop-shadow(0 0 20px rgba(46, 204, 113, 0.4));
}

h1 {
  font-size: clamp(28px, 5vw, 42px);
  font-weight: 900;
  background: linear-gradient(135deg, #2ecc71, #f0b429);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -1px;
}

.subtitle {
  color: var(--text-muted);
  font-size: 14px;
  margin-top: 4px;
  font-family: 'Tajawal', sans-serif;
}

/* Navigation */
.main-nav {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.2s;
}

.nav-link:hover {
  border-color: var(--primary-light);
  color: var(--primary-light);
  transform: translateY(-1px);
}

.nav-link.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #fff;
  border-color: var(--primary-light);
}

/* Config Banner */
.config-banner {
  background: linear-gradient(135deg, rgba(240, 180, 41, 0.15), rgba(240, 180, 41, 0.05));
  border: 1px solid rgba(240, 180, 41, 0.3);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: #f0b429;
}

.config-banner code {
  background: rgba(0, 0, 0, 0.3);
  padding: 2px 8px;
  border-radius: 6px;
  font-family: monospace;
  font-size: 12px;
  color: #fff;
}

/* Stats Strip */
.stats-strip {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  backdrop-filter: blur(12px);
  transition: transform 0.2s, border-color 0.2s;
}

.stat-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.15);
}

.stat-card .val {
  font-size: 36px;
  font-weight: 900;
  line-height: 1;
  margin-bottom: 4px;
}

.stat-card .lbl {
  font-size: 12px;
  color: var(--text-muted);
  font-family: 'Tajawal', sans-serif;
}

.stat-card.green .val {
  color: var(--primary-light);
}

.stat-card.amber .val {
  color: var(--accent);
}

/* Main Card */
.main-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 28px;
  backdrop-filter: blur(12px);
  margin-bottom: 24px;
}

.section-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--primary-light);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}

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

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

.form-group.full {
  grid-column: 1 / -1;
}

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

select,
input[type="number"],
input[type="text"],
input[type="tel"] {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  color: var(--text);
  padding: 12px 14px;
  font-family: 'Cairo', sans-serif;
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s, background 0.2s;
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
}

select:focus,
input:focus {
  border-color: var(--primary-light);
  background: rgba(46, 204, 113, 0.07);
}

select option {
  background: #1a2a3a;
  color: var(--text);
}

.new-name-input {
  margin-top: 8px;
  display: none;
}

.new-name-input.show {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 22px;
  border-radius: 12px;
  border: none;
  font-family: 'Cairo', sans-serif;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  white-space: nowrap;
}

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

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #fff;
  box-shadow: 0 4px 15px rgba(46, 204, 113, 0.3);
}

.btn-primary:hover {
  box-shadow: 0 6px 20px rgba(46, 204, 113, 0.5);
  transform: translateY(-1px);
}

.btn-whatsapp {
  background: linear-gradient(135deg, #128C7E, #25D366);
  color: #fff;
  box-shadow: 0 4px 15px rgba(37, 211, 102, 0.3);
}

.btn-whatsapp:hover {
  box-shadow: 0 6px 20px rgba(37, 211, 102, 0.5);
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text);
}

.btn-outline:hover {
  border-color: var(--primary-light);
  color: var(--primary-light);
}

.btn-amber {
  background: linear-gradient(135deg, var(--accent-dark), var(--accent));
  color: #1a1a1a;
  box-shadow: 0 4px 15px rgba(240, 180, 41, 0.3);
}

.btn-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.btn-row .btn {
  flex: 1;
  min-width: 120px;
}

/* Quick Actions */
.quick-actions {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.quick-actions .btn {
  flex: 1;
  min-width: 200px;
}

/* Toast */
#toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #1e3a2a;
  border: 1px solid var(--primary-light);
  color: var(--text);
  padding: 12px 24px;
  border-radius: 40px;
  font-size: 14px;
  transition: transform 0.3s ease;
  z-index: 9999;
  white-space: nowrap;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

#toast.show {
  transform: translateX(-50%) translateY(0);
}

#toast.error {
  background: #3a1e1e;
  border-color: var(--danger);
}

/* Loading */
.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}

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

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  z-index: 1000;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 24px 16px;
  overflow-y: auto;
}

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

.modal {
  background: #0f2040;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  width: 100%;
  max-width: 760px;
  padding: 28px;
  position: relative;
  animation: slideUp 0.3s ease;
  margin: auto;
}

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

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

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.modal-title {
  font-size: 20px;
  font-weight: 700;
}

.btn-close {
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: var(--text);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.btn-close:hover {
  background: rgba(255, 0, 0, 0.2);
}

/* Summary Cards */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.summary-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
}

.summary-card .s-val {
  font-size: 24px;
  font-weight: 900;
  color: var(--primary-light);
}

.summary-card .s-lbl {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Table */
.table-wrap {
  overflow-x: auto;
  border-radius: 12px;
  margin-bottom: 20px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th {
  background: rgba(26, 107, 74, 0.3);
  padding: 10px 14px;
  text-align: right;
  font-weight: 700;
  font-size: 12px;
  color: var(--primary-light);
  letter-spacing: 0.5px;
  white-space: nowrap;
}

td {
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  white-space: nowrap;
}

tr:hover td {
  background: rgba(255, 255, 255, 0.03);
}

.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
}

.badge-green {
  background: rgba(46, 204, 113, 0.15);
  color: var(--primary-light);
}

.badge-red {
  background: rgba(231, 76, 60, 0.15);
  color: #e74c3c;
}

/* Month filter */
.filter-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.filter-row label {
  margin: 0;
  white-space: nowrap;
}

.filter-row select {
  width: auto;
  flex: 1;
  min-width: 160px;
}

/* Section Divider */
.modal-section {
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.modal-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.modal-section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Status cards in modal */
.status-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.status-card {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 10px;
  padding: 12px;
  text-align: center;
}

.status-card .s-v {
  font-size: 22px;
  font-weight: 900;
}

.status-card .s-l {
  font-size: 10px;
  color: var(--text-muted);
}

/* Unpaid list */
.unpaid-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.unpaid-chip {
  background: rgba(231, 76, 60, 0.12);
  border: 1px solid rgba(231, 76, 60, 0.25);
  color: #e74c3c;
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
}

/* Excel Guide */
.excel-guide {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}

.guide-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 6px;
}

.guide-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.excel-preview {
  overflow-x: auto;
  border-radius: 8px;
  margin-bottom: 12px;
}

.excel-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.excel-table th {
  background: rgba(26, 107, 74, 0.4);
  padding: 8px 12px;
  text-align: right;
  color: var(--primary-light);
  font-size: 12px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.excel-table td {
  padding: 7px 12px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.02);
}

.guide-notes {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.guide-note {
  font-size: 12px;
  color: var(--text-muted);
}

.guide-note strong {
  color: var(--text);
}

/* Import Month Filter */
.import-month-box {
  background: rgba(240, 180, 41, 0.07);
  border: 1px solid rgba(240, 180, 41, 0.2);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 14px;
}

.import-month-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 10px;
  letter-spacing: 0.5px;
}

.import-month-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.import-month-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 8px;
}

/* Upload Area */
.upload-area {
  border: 2px dashed rgba(255, 255, 255, 0.15);
  border-radius: 14px;
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 16px;
  background: rgba(255, 255, 255, 0.02);
}

.upload-area:hover,
.upload-area.drag-over {
  border-color: var(--primary-light);
  background: rgba(46, 204, 113, 0.06);
}

.upload-icon {
  font-size: 36px;
  margin-bottom: 8px;
}

.upload-text {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
}

.upload-sub {
  font-size: 12px;
  color: var(--text-muted);
}

/* Preview */
.preview-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 700;
}

/* Progress */
.progress-bar-wrap {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  height: 10px;
  overflow: hidden;
  margin-top: 16px;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  border-radius: 20px;
  width: 0%;
  transition: width 0.3s ease;
}

/* Import Errors */
.import-errors {
  background: rgba(231, 76, 60, 0.08);
  border: 1px solid rgba(231, 76, 60, 0.2);
  border-radius: 10px;
  padding: 12px;
  margin-top: 10px;
  font-size: 12px;
  color: #e74c3c;
  max-height: 100px;
  overflow-y: auto;
}

/* Import Result */
.result-card {
  background: rgba(46, 204, 113, 0.08);
  border: 1px solid rgba(46, 204, 113, 0.25);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
  margin-top: 12px;
}

.result-card.error {
  background: rgba(231, 76, 60, 0.08);
  border-color: rgba(231, 76, 60, 0.25);
}

/* Toggle Switch */
.toggle-row {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  user-select: none;
}

.toggle-switch {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

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

.slider {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 24px;
  transition: 0.3s;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  right: 3px;
  top: 2px;
  background: #fff;
  border-radius: 50%;
  transition: 0.3s;
}

.toggle-switch input:checked+.slider {
  background: var(--primary);
  border-color: var(--primary-light);
}

.toggle-switch input:checked+.slider::before {
  transform: translateX(-20px);
}

.toggle-label {
  font-size: 13px;
  color: var(--text-muted);
}

/* Print */
@media print {
  body {
    background: #fff;
    color: #000;
  }

  .no-print {
    display: none !important;
  }

  .modal-overlay {
    position: static;
    background: none;
  }

  .modal {
    border: none;
    background: #fff;
  }

  th {
    background: #e0f0e8 !important;
    color: #1a6b4a !important;
  }
}

/* Footer */
.footer-text {
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
  padding-bottom: 24px;
}

/* Responsive */
@media (max-width: 600px) {
  .form-grid {
    grid-template-columns: 1fr;
  }

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

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

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

  .btn-row {
    flex-direction: column;
  }

  .btn-row .btn {
    width: 100%;
  }

  .main-card {
    padding: 20px 16px;
  }

  .modal {
    padding: 20px 16px;
  }

  .quick-actions {
    flex-direction: column;
  }

  .quick-actions .btn {
    width: 100%;
  }
}

/* Animation */
.fade-in {
  animation: fadeIn 0.4s ease;
}

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

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

.pulse {
  animation: pulse 2s infinite;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.5;
  }
}

/* Empty state */
.empty {
  text-align: center;
  padding: 32px;
  color: var(--text-muted);
  font-size: 14px;
}
