:root {
  --primary: #005DBA;
  --primary-shadow: rgba(0, 93, 186, 0.5);
  --secondary: #364153;
  --bg: #f0f4f9;
  --card-bg: #ffffff;
  --border: #e2e8f0;
  --text: #1a202c;
  --text-muted: #64748b;
  --urgency-low: #d1fae5;
  --urgency-low-text: #065f46;
  --urgency-medium: #fef9c3;
  --urgency-medium-text: #854d0e;
  --urgency-urgent: #fee2e2;
  --urgency-urgent-text: #991b1b;
  --radius: 12px;
  --radius-sm: 8px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ── Auth pages ── */
.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg);
}

.auth-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px var(--primary-shadow);
  padding: 40px 36px;
  width: 100%;
  max-width: 400px;
}

.auth-card h1 {
  color: var(--primary);
  font-size: 1.6rem;
  margin-bottom: 8px;
}

.auth-card p {
  color: var(--text-muted);
  margin-bottom: 28px;
  font-size: 0.9rem;
}

/* ── Form elements ── */
.field { margin-bottom: 18px; }

.field label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--secondary);
  margin-bottom: 6px;
}

.field input,
.field select,
.field textarea {
  width: 100% !important;
  padding: 10px 14px !important;
  border: 1.5px solid var(--border) !important;
  border-radius: var(--radius-sm) !important;
  font-size: 0.95rem !important;
  color: var(--text) !important;
  background: #fff !important;
  transition: border-color 0.15s;
  font-family: inherit !important;
  box-shadow: none !important;
  outline: none !important;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none !important;
  border-color: var(--primary) !important;
  box-shadow: none !important;
}

.field textarea { resize: vertical; min-height: 100px; }

/* ── Buttons ── */
.btn {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 22px !important;
  border-radius: 999px !important;
  border: none !important;
  font-size: 0.95rem !important;
  font-weight: 600 !important;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
  box-shadow: none !important;
  text-decoration: none !important;
  line-height: 1.2 !important;
}
.btn:active { transform: scale(0.97); }

.btn-primary { background: var(--primary) !important; color: #fff !important; }
.btn-primary:hover { opacity: 0.88; background: var(--primary) !important; color: #fff !important; }

.btn-danger { background: transparent !important; color: #dc2626 !important; font-size: 0.95rem !important; padding: 10px 16px !important; }
.btn-danger:hover { text-decoration: underline !important; }

.btn-sm { padding: 6px 14px !important; font-size: 0.8rem !important; }

.btn-full { width: 100% !important; }

/* ── Dashboard layout ── */
.dashboard { max-width: 1200px; margin: 0 auto; padding: 28px 20px; }

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

.dashboard-header h1 { font-size: 1.4rem; color: var(--secondary); }

/* ── Stat cards ── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: 0 4px 16px var(--primary-shadow);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon svg { color: #fff; width: 24px; height: 24px; }

.stat-info { flex: 1; }

.stat-count {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ── Section cards ── */
.section-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: 0 4px 24px var(--primary-shadow);
  padding: 24px;
  margin-bottom: 24px;
}

.section-card h2 {
  font-size: 1.3rem;
  color: var(--text);
  margin-bottom: 20px;
}

/* ── Kanban board ── */
.kanban-board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.kanban-col {
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  min-height: 240px;
  background: #f8fafc;
}

.kanban-col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.kanban-col-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.kanban-badge {
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  width: 26px;
  height: 26px;
  font-size: 0.8rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.kanban-items { display: flex; flex-direction: column; gap: 0; }

/* ── Item card ── */
.item-card {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  cursor: grab;
}
.item-card:last-child { border-bottom: none; }
.item-card:active { cursor: grabbing; }
.item-card.dragging { opacity: 0.4; }

.item-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.item-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
  cursor: pointer;
}
.item-name:hover { color: var(--primary); }

.item-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.drop-zone {
  min-height: 40px;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}
.drop-zone.drag-over { background: rgba(0, 93, 186, 0.06); }

/* ── Urgency badges ── */
.urgency-badge {
  display: inline-block;
  padding: 2px 12px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}
.urgency-low    { background: var(--urgency-low);    color: var(--urgency-low-text); }
.urgency-medium { background: var(--urgency-medium); color: var(--urgency-medium-text); }
.urgency-urgent { background: var(--urgency-urgent); color: var(--urgency-urgent-text); }

/* ── View more ── */
.view-more {
  display: block;
  text-align: center;
  margin-top: 14px;
  color: var(--primary);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}
.view-more:hover { text-decoration: underline; }

/* ── Receipts table ── */
.receipts-table { width: 100%; border-collapse: collapse; }

/* Reset any theme-injected borders */
.receipts-table th,
.receipts-table td { border: none !important; }

.receipts-table th {
  text-align: left;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
  padding: 0 0 12px;
}

.receipts-table td {
  padding: 14px 0;
  font-size: 0.9rem;
  color: var(--text);
  vertical-align: top;
}

.receipts-table tr + tr td { border-top: 1px solid var(--border) !important; }

/* Hide header row when table is empty */
.receipts-table:has(tbody:empty) thead { display: none; }

.receipt-view-link {
  color: var(--primary);
  font-weight: 600;
  cursor: pointer;
  background: none;
  border: none;
  font-size: 0.9rem;
  padding: 0;
}
.receipt-view-link:hover { text-decoration: underline; }

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal {
  background: #fff;
  border-radius: var(--radius);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 32px;
  position: relative;
}

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

.modal-header h2 { font-size: 1.5rem; font-weight: 800; }

.modal-close {
  background: none !important;
  border: none !important;
  cursor: pointer;
  color: var(--text) !important;
  line-height: 0;
  padding: 4px;
  border-radius: 0 !important;
  width: auto !important;
  height: auto !important;
  display: flex !important;
  align-items: center;
  justify-content: center;
  box-shadow: none !important;
}
.modal-close:hover {
  color: var(--primary) !important;
  background: none !important;
  opacity: 1 !important;
}
.modal-close svg { display: block; }

.modal-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
}

.receipt-image-box {
  border: 1.5px solid var(--primary);
  border-radius: var(--radius);
  min-height: 360px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.receipt-image-box img {
  width: 100%;
  height: auto;
  display: block;
}

.receipt-image-box iframe {
  width: 100%;
  height: 500px;
  border: none;
}

/* ── Error / success ── */
.alert {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  margin-bottom: 16px;
}
.alert-error   { background: #fee2e2; color: #991b1b; }
.alert-success { background: #d1fae5; color: #065f46; }

/* ── Nav ── */
.nav {
  background: var(--primary);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 8px var(--primary-shadow);
}

.nav-brand {
  color: #fff !important;
  font-weight: 800;
  font-size: 1.1rem;
  text-decoration: none !important;
}
.nav-brand:hover { color: rgba(255,255,255,0.8) !important; }

.nav-user {
  display: flex;
  align-items: center;
  gap: 14px;
  color: rgba(255,255,255,0.85);
  font-size: 0.88rem;
}

.nav-user button {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.3);
  color: #fff;
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
}
.nav-user button:hover { background: rgba(255,255,255,0.25); }

/* ── Benevolence form ── */
.modal-wide { max-width: 700px; }

.benev-notice {
  font-size: 0.85rem;
  color: var(--text-muted);
  background: #f0f4f9;
  border-left: 3px solid var(--primary);
  padding: 12px 14px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-bottom: 20px;
  line-height: 1.5;
}

.benev-section {
  background: #f8fafc;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin: 20px 0;
}

.benev-committee-section {
  background: #fff8f0;
  border: 1.5px solid #f59e0b;
  border-radius: var(--radius-sm);
  padding: 16px;
  margin: 20px 0;
}

.benev-committee-header {
  font-weight: 700;
  font-size: 0.95rem;
  color: #92400e;
  margin-bottom: 14px;
  letter-spacing: 0.03em;
}

.benev-radio-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  font-weight: 400;
  cursor: pointer;
  color: var(--text);
}

.benev-radio-label input[type="radio"] { width: 16px; height: 16px; cursor: pointer; }

.benev-guidelines {
  background: #f8fafc;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-top: 20px;
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.benev-guidelines p { margin-bottom: 8px; }
.benev-guidelines p:last-child { margin-bottom: 0; }

.hidden { display: none !important; }

@media (max-width: 768px) {
  .kanban-board { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }

  /* Receipts table: hide Date, Ministry, Description, Amount — keep Submitted By + View */
  .receipts-table th:nth-child(1),
  .receipts-table td:nth-child(1),
  .receipts-table th:nth-child(2),
  .receipts-table td:nth-child(2),
  .receipts-table th:nth-child(3),
  .receipts-table td:nth-child(3),
  .receipts-table th:nth-child(4),
  .receipts-table td:nth-child(4) {
    display: none;
  }
}
