/* ── CSS Custom Properties ──────────────────────────────────── */
:root {
  --bg-body: #0d1117;
  --bg-surface: #161b22;
  --bg-card: rgba(22, 27, 34, 0.85);
  --bg-card-hover: rgba(30, 37, 48, 0.95);
  --bg-modal: #1c2333;
  --bg-input: #0d1117;
  --border-subtle: rgba(240, 246, 252, 0.08);
  --border-input: rgba(240, 246, 252, 0.15);
  --border-input-focus: #58a6ff;

  --text-primary: #e6edf3;
  --text-secondary: #8b949e;
  --text-muted: #6e7681;
  --text-link: #58a6ff;

  --accent-1: #3fb950;
  /* Account Created – green */
  --accent-2: #58a6ff;
  /* Education Applied – blue */
  --accent-3: #d2a8ff;
  /* Status – purple */
  --accent-4: #f0883e;
  /* Benefits Granted – amber */
  --accent-5: #39d353;
  /* Paid Out – bright green */

  --danger: #f85149;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-card: 0 2px 8px rgba(0, 0, 0, .3);
  --shadow-modal: 0 16px 70px rgba(0, 0, 0, .55);
  --transition: 0.2s cubic-bezier(.4, 0, .2, 1);

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ── Light Theme ────────────────────────────────────────────── */
[data-theme="light"] {
  --bg-body: #f0f2f5;
  --bg-surface: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.92);
  --bg-card-hover: rgba(255, 255, 255, 1);
  --bg-modal: #ffffff;
  --bg-input: #f6f8fa;
  --border-subtle: rgba(0, 0, 0, 0.1);
  --border-input: rgba(0, 0, 0, 0.15);
  --border-input-focus: #0969da;

  --text-primary: #1f2328;
  --text-secondary: #656d76;
  --text-muted: #8b949e;
  --text-link: #0969da;

  --accent-1: #1a7f37;
  --accent-2: #0969da;
  --accent-3: #8250df;
  --accent-4: #bf5700;
  --accent-5: #1a7f37;

  --danger: #cf222e;
  --shadow-card: 0 1px 4px rgba(0, 0, 0, .08), 0 2px 8px rgba(0, 0, 0, .06);
  --shadow-modal: 0 16px 70px rgba(0, 0, 0, .18);
}

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

html {
  font-size: 15px;
}

body {
  font-family: var(--font);
  background: var(--bg-body);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  transition: background 0.3s ease, color 0.3s ease;
}

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

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

::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  border-radius: 3px;
}

/* ── HEADER ────────────────────────────────────────────────── */
#app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 24px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  width: 28px;
  height: 28px;
  color: var(--accent-2);
  flex-shrink: 0;
}

#app-header h1 {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

#app-header h1 .accent {
  background: linear-gradient(135deg, var(--accent-2), var(--accent-3));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Stats bar */
.stats-bar {
  display: flex;
  gap: 6px;
}

.stat-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.73rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.stat-chip .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}

/* Theme toggle button */
.btn-theme {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-subtle);
  border-radius: 50%;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
}

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

.btn-theme:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
  border-color: rgba(240, 246, 252, 0.2);
}

[data-theme="light"] .btn-theme:hover {
  background: rgba(0, 0, 0, 0.05);
}

/* Show moon in dark, sun in light */
.icon-sun {
  display: none;
}

.icon-moon {
  display: block;
}

[data-theme="light"] .icon-sun {
  display: block;
}

[data-theme="light"] .icon-moon {
  display: none;
}

/* Add button */
.btn-add {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border: none;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent-2), var(--accent-3));
  color: #fff;
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
  white-space: nowrap;
}

.btn-add svg {
  width: 16px;
  height: 16px;
}

.btn-add:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(88, 166, 255, 0.35);
}

/* ── MOBILE TAB BAR ────────────────────────────────────────── */
.mobile-tabs {
  display: none;
  gap: 4px;
  padding: 8px 12px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.mobile-tabs .tab {
  flex-shrink: 0;
  padding: 6px 14px;
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}

.mobile-tabs .tab.active {
  background: rgba(88, 166, 255, 0.15);
  color: var(--accent-2);
  border-color: rgba(88, 166, 255, 0.3);
}

/* ── BOARD ─────────────────────────────────────────────────── */
.board {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  padding: 16px;
  min-height: calc(100vh - 62px);
  align-items: start;
}

/* ── COLUMN ────────────────────────────────────────────────── */
.column {
  background: rgba(22, 27, 34, 0.5);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  min-height: 200px;
  overflow: hidden;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

[data-theme="light"] .column {
  background: rgba(255, 255, 255, 0.6);
}

/* Drag-and-drop: column highlight */
.column.drag-over {
  border-color: var(--accent-2);
  box-shadow: inset 0 0 0 1px var(--accent-2), 0 0 20px rgba(88, 166, 255, 0.15);
}

[data-theme="light"] .column.drag-over {
  box-shadow: inset 0 0 0 1px var(--accent-2), 0 0 20px rgba(9, 105, 218, 0.12);
}

.column-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-subtle);
}

.column-header .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.column-header h2 {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  flex: 1;
}

.column-header .count {
  background: rgba(255, 255, 255, 0.06);
  padding: 2px 9px;
  border-radius: 12px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-secondary);
}

/* Stage colors */
.stage-1 .dot {
  background: var(--accent-1);
}

.stage-2 .dot {
  background: var(--accent-2);
}

.stage-3 .dot {
  background: var(--accent-3);
}

.stage-4 .dot {
  background: var(--accent-4);
}

.stage-5 .dot {
  background: var(--accent-5);
}

.stage-1 h2 {
  color: var(--accent-1);
}

.stage-2 h2 {
  color: var(--accent-2);
}

.stage-3 h2 {
  color: var(--accent-3);
}

.stage-4 h2 {
  color: var(--accent-4);
}

.stage-5 h2 {
  color: var(--accent-5);
}

/* ── CARD LIST ─────────────────────────────────────────────── */
.card-list {
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  overflow-y: auto;
  max-height: calc(100vh - 150px);
}

/* ── CARD ──────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px;
  cursor: grab;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition), opacity var(--transition);
  animation: cardIn 0.3s ease-out;
}

.card:active {
  cursor: grabbing;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card);
  border-color: rgba(240, 246, 252, 0.15);
}

/* Drag-and-drop: dragging card */
.card.dragging {
  opacity: 0.4;
  transform: scale(0.95);
  box-shadow: none;
}

@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.97);
  }

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

.card-name {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--text-primary);
}

.card-detail {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-bottom: 2px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.card-detail svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  opacity: 0.6;
}

.card-amount {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-top: 6px;
  padding: 3px 9px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  background: rgba(88, 166, 255, 0.1);
  color: var(--accent-2);
}

.card-status-badge {
  display: inline-block;
  margin-top: 6px;
  margin-left: 6px;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
}

.badge-approved {
  background: rgba(63, 185, 80, 0.15);
  color: var(--accent-1);
}

.badge-declined {
  background: rgba(248, 81, 73, 0.15);
  color: var(--danger);
}

.card-actions {
  display: flex;
  gap: 4px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle);
}

.card-actions button {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 5px 4px;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}

.card-actions button svg {
  width: 13px;
  height: 13px;
}

.card-actions button:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
  border-color: rgba(240, 246, 252, 0.2);
}

.card-actions .btn-card-delete:hover {
  background: rgba(248, 81, 73, 0.12);
  color: var(--danger);
  border-color: rgba(248, 81, 73, 0.3);
}

/* ── MODALS ────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

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

.modal {
  background: var(--bg-modal);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  width: 92%;
  max-width: 460px;
  padding: 24px;
  box-shadow: var(--shadow-modal);
  transform: translateY(20px) scale(0.97);
  transition: transform 0.25s ease;
}

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

.modal-sm {
  max-width: 380px;
}

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

.modal-header h2 {
  font-size: 1.1rem;
  font-weight: 700;
}

.btn-close {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}

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

.btn-close:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
}

/* ── FORM ──────────────────────────────────────────────────── */
.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-input);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 0.9rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--border-input-focus);
  box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.15);
}

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

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

.flex-grow {
  flex: 1;
}

.form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
}

.btn-cancel {
  padding: 9px 18px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}

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

.btn-submit {
  padding: 9px 22px;
  border: none;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent-2), var(--accent-3));
  color: #fff;
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
}

.btn-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 18px rgba(88, 166, 255, 0.3);
}

.btn-danger {
  padding: 9px 22px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--danger);
  color: #fff;
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
}

.btn-danger:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 18px rgba(248, 81, 73, 0.35);
}

.delete-msg {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ── MOVE OPTIONS ──────────────────────────────────────────── */
.move-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.move-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  text-align: left;
}

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

.move-btn:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(240, 246, 252, 0.2);
}

.move-btn.current {
  opacity: 0.4;
  cursor: default;
  pointer-events: none;
}

.move-btn.stage-3-option {
  position: relative;
}

.status-select {
  margin-left: auto;
  padding: 4px 8px;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  background: var(--bg-input);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

/* ── TOAST ─────────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 2000;
}

.toast {
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  font-weight: 600;
  color: #fff;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .4);
  animation: toastIn 0.3s ease-out;
  max-width: 320px;
}

.toast.success {
  background: linear-gradient(135deg, #238636, #2ea043);
}

.toast.error {
  background: linear-gradient(135deg, #da3633, #f85149);
}

.toast.info {
  background: linear-gradient(135deg, #1f6feb, #58a6ff);
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(40px);
  }

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

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

@keyframes toastOut {
  to {
    opacity: 0;
    transform: translateX(40px);
  }
}

/* ── EMPTY STATE ───────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  text-align: center;
  color: var(--text-muted);
}

.empty-state svg {
  width: 36px;
  height: 36px;
  margin-bottom: 10px;
  opacity: 0.35;
}

.empty-state p {
  font-size: 0.78rem;
  font-weight: 500;
}

/* ── DRAG PLACEHOLDER ──────────────────────────────────────── */
.drag-placeholder {
  border: 2px dashed var(--accent-2);
  border-radius: var(--radius-sm);
  background: rgba(88, 166, 255, 0.05);
  min-height: 60px;
  transition: min-height 0.2s ease;
}

[data-theme="light"] .drag-placeholder {
  background: rgba(9, 105, 218, 0.04);
}

/* ── STATUS PROMPT (for stage 3 drop) ──────────────────────── */
.status-prompt-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1100;
  animation: fadeIn 0.2s ease;
}

.status-prompt {
  background: var(--bg-modal);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  box-shadow: var(--shadow-modal);
}

.status-prompt h3 {
  margin-bottom: 16px;
  font-size: 1rem;
  font-weight: 700;
}

.status-prompt-btns {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.status-prompt-btns button {
  padding: 9px 24px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
}

.status-prompt-btns button:hover {
  transform: translateY(-1px);
}

.btn-approved {
  background: var(--accent-1);
  color: #fff;
}

.btn-declined {
  background: var(--danger);
  color: #fff;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

/* ── RESPONSIVE ────────────────────────────────────────────── */

/* Tablet */
@media (max-width: 1100px) {
  .board {
    grid-template-columns: repeat(3, 1fr);
  }

  .stats-bar {
    display: none;
  }
}

/* Mobile */
@media (max-width: 700px) {
  #app-header {
    padding: 10px 14px;
  }

  #app-header h1 {
    font-size: 1rem;
  }

  .btn-add span {
    display: none;
  }

  .btn-add {
    padding: 8px 10px;
  }

  .mobile-tabs {
    display: flex;
  }

  .board {
    grid-template-columns: 1fr;
    padding: 8px;
    gap: 8px;
    min-height: auto;
  }

  .column {
    display: none;
  }

  .column.active-mobile {
    display: flex;
  }

  .card-list {
    max-height: calc(100vh - 200px);
  }
}

@media (max-width: 420px) {
  .modal {
    width: 96%;
    padding: 18px;
  }

  .form-row {
    flex-direction: column;
    gap: 0;
  }
}