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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: linear-gradient(135deg, #1a8a4a 0%, #0f6b3a 50%, #0a4d2b 100%);
  min-height: 100vh;
  color: #2c3e50;
}

.container {
  max-width: 1400px;
  margin: 20px auto;
  background: #fff;
  border-radius: 15px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.1);
  overflow: hidden;
}

/* ── Header ── */
.header {
  background: linear-gradient(135deg, #ecf0f1, #dfe6e9);
  padding: 18px 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 3px solid #27ae60;
}

.header h1 {
  font-size: 24px;
  color: #2c3e50;
  font-weight: 600;
}

.header h1 span {
  color: #27ae60;
}

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

.header-right span {
  font-size: 0.85rem;
  color: #555;
}

/* ── Hamburger Button ── */
.hamburger-btn {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  transition: background 0.2s;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
}

.hamburger-btn:hover {
  background: rgba(0,0,0,0.08);
}

.hamburger-btn svg {
  width: 24px;
  height: 24px;
  color: #2c3e50;
}

/* ── Navigation Tabs ── */
.nav-tabs {
  display: flex;
  background: #f8f9fa;
  border-bottom: 2px solid #e9ecef;
  padding: 0 20px;
  overflow-x: auto;
}

.nav-tab {
  padding: 13px 22px;
  cursor: pointer;
  font-size: 0.88rem;
  color: #666;
  border-bottom: 3px solid transparent;
  transition: all 0.2s;
  white-space: nowrap;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  font-family: inherit;
  font-weight: 500;
}

.nav-tab:hover {
  color: #27ae60;
  background: rgba(39,174,96,0.05);
}

.nav-tab.active {
  color: #27ae60;
  border-bottom-color: #27ae60;
  font-weight: 600;
  background: #fff;
}

/* ── Tab Content ── */
.tab-content {
  display: none;
  padding: 25px 30px 35px;
}

.tab-content.active {
  display: block;
}

/* ── Forms ── */
.form-group {
  margin-bottom: 15px;
}

.form-group label {
  display: block;
  margin-bottom: 5px;
  font-weight: 600;
  font-size: 0.82rem;
  color: #555;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid #ddd;
  border-radius: 8px;
  font-size: 0.9rem;
  transition: all 0.2s;
  font-family: inherit;
  background: #fff;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #27ae60;
  box-shadow: 0 0 0 3px rgba(39,174,96,0.1);
}

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

.form-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 15px;
}

/* ── Buttons ── */
.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-size: 0.85rem;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary { background: #27ae60; color: #fff; }
.btn-primary:hover { background: #219a52; }

.btn-success { background: #27ae60; color: #fff; }
.btn-success:hover { background: #219a52; }

.btn-warning { background: #f39c12; color: #fff; }
.btn-warning:hover { background: #e08e0b; }

.btn-danger { background: #e74c3c; color: #fff; }
.btn-danger:hover { background: #d44332; }

.btn-secondary { background: #6c757d; color: #fff; }
.btn-secondary:hover { background: #5a6268; }

.btn-info { background: #0077B6; color: #fff; }
.btn-info:hover { background: #005A8C; }

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

.btn-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

/* ── Tables ── */
table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
}

table th, table td {
  padding: 11px 14px;
  text-align: left;
  font-size: 0.88rem;
}

table th {
  background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
  color: #fff;
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

table th:first-child {
  border-radius: 8px 0 0 0;
}

table th:last-child {
  border-radius: 0 8px 0 0;
}

table td {
  border-bottom: 1px solid #f0f0f0;
}

table tbody tr:hover {
  background: #fafbfc;
}

table tbody tr:last-child td {
  border-bottom: none;
}

/* ── Cards ── */
.card {
  background: #fff;
  border-radius: 12px;
  padding: 22px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
  border: 1px solid #eef0f2;
}

.card h3 {
  color: #2c3e50;
  font-size: 1rem;
  margin-bottom: 15px;
}

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

.stat-card {
  background: #fff;
  border-radius: 12px;
  padding: 22px 20px;
  text-align: center;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
  border: 1px solid #eef0f2;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
}

.stat-card:nth-child(1)::before { background: linear-gradient(90deg, #27ae60, #2ecc71); }
.stat-card:nth-child(2)::before { background: linear-gradient(90deg, #e74c3c, #c0392b); }
.stat-card:nth-child(3)::before { background: linear-gradient(90deg, #f39c12, #e08e0b); }
.stat-card:nth-child(4)::before { background: linear-gradient(90deg, #3498db, #2980b9); }
.stat-card:nth-child(5)::before { background: linear-gradient(90deg, #0077B6, #00B4D8); }

.stat-card .stat-value {
  font-size: 2.2rem;
  font-weight: 700;
  color: #2c3e50;
  line-height: 1;
}

.stat-card .stat-label {
  font-size: 0.78rem;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 8px;
}

/* ── Badges ── */
.role-badge {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.role-badge.admin { background: #e8f4f8; color: #3498db; }
.role-badge.employee { background: #eef0f2; color: #636e72; }

.status-badge {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  display: inline-block;
}

.status-badge.pending { background: #fef5e7; color: #d68910; }
.status-badge.approved { background: #e8f8f0; color: #27ae60; }
.status-badge.rejected { background: #fdedeb; color: #e74c3c; }
.status-badge.open { background: #e8f8f0; color: #27ae60; }
.status-badge.closed { background: #eef0f2; color: #636e72; }

/* ── Modal ── */
.modal {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: #fff;
  border-radius: 14px;
  padding: 28px;
  width: 90%;
  max-width: 600px;
  max-height: 85vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 25px 50px rgba(0,0,0,0.25);
}

.modal-content h3 {
  margin-bottom: 20px;
  color: #2c3e50;
  font-size: 1.1rem;
}

.modal-close {
  position: absolute;
  top: 15px;
  right: 18px;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #888;
  transition: color 0.2s;
}

.modal-close:hover {
  color: #e74c3c;
}

/* ── Toolbar ── */
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 10px;
}

.toolbar h2 {
  font-size: 1.15rem;
  color: #2c3e50;
  font-weight: 700;
}

.search-input {
  padding: 9px 14px;
  border: 1.5px solid #ddd;
  border-radius: 8px;
  font-size: 0.85rem;
  width: 250px;
  transition: border-color 0.2s;
}

.search-input:focus {
  outline: none;
  border-color: #27ae60;
  box-shadow: 0 0 0 3px rgba(39,174,96,0.1);
}

.filter-group {
  display: flex;
  gap: 10px;
  align-items: center;
}

.filter-group select {
  padding: 8px 12px;
  border: 1.5px solid #ddd;
  border-radius: 8px;
  font-size: 0.85rem;
}

/* ── Alert / Messages ── */
.alert {
  padding: 12px 18px;
  border-radius: 10px;
  margin-bottom: 15px;
  font-size: 0.88rem;
  font-weight: 500;
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.alert-success { background: #e8f8f0; color: #27ae60; border-left: 4px solid #27ae60; }
.alert-error { background: #fdedeb; color: #e74c3c; border-left: 4px solid #e74c3c; }
.alert-warning { background: #fef9e7; color: #d68910; border-left: 4px solid #f39c12; }
.alert-info { background: #e8f4f8; color: #2e86c1; border-left: 4px solid #3498db; }

/* ── Empty state ── */
.empty-state {
  text-align: center;
  padding: 50px 20px;
  color: #bbb;
}

.empty-state p {
  font-size: 1rem;
  margin-bottom: 15px;
}

/* ── Amount formatting ── */
.amount-cell {
  font-family: 'Segoe UI', Roboto, monospace;
  font-weight: 600;
  text-align: right !important;
}

.amount-positive { color: #27ae60; }
.amount-negative { color: #e74c3c; }

/* ── Balance Card ── */
.balance-card {
  background: linear-gradient(135deg, #27ae60, #219a52);
  color: #fff;
  border-radius: 16px;
  padding: 30px;
  text-align: center;
  margin-bottom: 25px;
  box-shadow: 0 8px 25px rgba(39,174,96,0.3);
}

.balance-card .balance-label {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  opacity: 0.9;
}

.balance-card .balance-amount {
  font-size: 2.8rem;
  font-weight: 700;
  margin: 10px 0;
}

.balance-card .balance-details {
  display: flex;
  justify-content: center;
  gap: 40px;
  margin-top: 15px;
  font-size: 0.85rem;
  opacity: 0.9;
}

/* ── Audit Action Badges ── */
.audit-action {
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
  background: #eef0f2;
  color: #636e72;
}

.audit-action.create { background: #e8f8f0; color: #27ae60; }
.audit-action.update { background: #e8f4f8; color: #2e86c1; }
.audit-action.approve { background: #e8f8f0; color: #27ae60; }
.audit-action.reject { background: #fdedeb; color: #e74c3c; }
.audit-action.delete { background: #fdedeb; color: #e74c3c; }
.audit-action.close { background: #eef0f2; color: #636e72; }

/* ── Mobile Nav Overlay ── */
.mobile-nav-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 9998;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.mobile-nav-overlay.open {
  display: block;
  opacity: 1;
}

/* ── Mobile Nav Panel ── */
.mobile-nav {
  position: fixed;
  top: 0;
  left: 0;
  width: 280px;
  height: 100%;
  background: #fff;
  z-index: 9999;
  transform: translateX(-100%);
  transition: transform 0.3s ease;
  display: flex;
  flex-direction: column;
  box-shadow: 4px 0 20px rgba(0,0,0,0.15);
}

.mobile-nav.open {
  transform: translateX(0);
}

.mobile-nav-header {
  padding: 20px;
  background: linear-gradient(135deg, #ecf0f1, #dfe6e9);
  border-bottom: 3px solid #27ae60;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mobile-nav-header h2 {
  font-size: 1.2rem;
  color: #2c3e50;
  font-weight: 700;
}

.mobile-nav-header h2 span {
  color: #27ae60;
}

.mobile-nav-header button {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #666;
  padding: 5px;
}

.mobile-nav-user {
  padding: 15px 20px;
  border-bottom: 1px solid #eee;
  font-size: 0.9rem;
  color: #555;
}

.mobile-nav-user strong {
  display: block;
  color: #2c3e50;
  margin-bottom: 2px;
}

.mobile-nav-links {
  flex: 1;
  overflow-y: auto;
  padding: 10px 0;
}

.mobile-nav-link {
  display: block;
  width: 100%;
  padding: 14px 20px;
  border: none;
  background: none;
  text-align: left;
  font-size: 0.95rem;
  color: #333;
  cursor: pointer;
  transition: background 0.2s;
  font-family: inherit;
  font-weight: 500;
}

.mobile-nav-link:hover {
  background: #f0f4f8;
}

.mobile-nav-link.active {
  background: #e8f8f0;
  color: #27ae60;
  font-weight: 600;
  border-left: 3px solid #27ae60;
}

.mobile-nav-footer {
  padding: 15px 20px;
  border-top: 1px solid #eee;
}

.mobile-nav-action {
  display: block;
  width: 100%;
  padding: 10px;
  margin-bottom: 8px;
  border: 1px solid #ddd;
  border-radius: 8px;
  background: #f8f9fa;
  text-align: center;
  font-size: 0.85rem;
  cursor: pointer;
  font-family: inherit;
  color: #555;
}

.mobile-nav-action:hover {
  background: #e9ecef;
}

.mobile-nav-logout {
  display: block;
  width: 100%;
  padding: 10px;
  border: none;
  border-radius: 8px;
  background: #e74c3c;
  color: #fff;
  text-align: center;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.mobile-nav-logout:hover {
  background: #d44332;
}

/* ── Scrollable Table Wrapper ── */
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 -2px;
  padding: 0 2px;
}

/* ── Header role badge (mobile only) ── */
.header-role-badge {
  display: none;
  padding: 5px 16px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: #fff;
  background: #27ae60;
  margin-left: auto;
}

/* ── Chart ── */
.chart-container {
  position: relative;
  max-height: 300px;
  margin: 15px 0;
}
.chart-filter {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 0;
  font-size: 0.88rem;
}
.chart-filter select {
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid #ddd;
  font-size: 0.85rem;
  min-height: auto;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .container { margin: 0; border-radius: 0; min-height: 100vh; }
  .header {
    flex-direction: row;
    padding: 12px 15px;
  }
  .header h1 { font-size: 18px; }
  .hamburger-btn { display: flex; }
  .header-role-badge { display: inline-block; }
  .nav-tabs { display: none; }
  .header-desktop-only { display: none !important; }
  .tab-content { padding: 12px; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar h2 { font-size: 1rem; }
  .search-input { width: 100%; }

  /* Tables: compact but allow text columns to wrap */
  table { font-size: 0.78rem; width: 100%; }
  table th, table td { padding: 7px 6px; }
  table th { font-size: 0.68rem; letter-spacing: 0.3px; }
  /* Keep short columns compact */
  .amount-cell { white-space: nowrap; }
  .status-badge { white-space: nowrap; }
  table td .btn-group { flex-wrap: nowrap; gap: 4px; }
  /* Description / text columns can wrap */
  .cell-desc { min-width: 100px; word-break: break-word; }

  .stat-cards { grid-template-columns: 1fr 1fr; }
  .stat-card .stat-value { font-size: 1.6rem; }
  .stat-card .stat-label { font-size: 0.7rem; }
  .stat-card { padding: 15px 12px; }

  /* Balance card */
  .balance-card { padding: 20px 15px; }
  .balance-card .balance-amount { font-size: 2rem; }
  .balance-card .balance-details { gap: 20px; font-size: 0.8rem; flex-wrap: wrap; }

  /* Settings grid (inline style override) */
  [style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }

  /* Touch-friendly inputs */
  .form-group input,
  .form-group select,
  .form-group textarea {
    font-size: 16px;
    min-height: 44px;
  }

  .btn { min-height: 44px; }
  .btn-sm { min-height: 36px; font-size: 0.72rem; padding: 5px 8px; }

  .modal-content {
    width: 100%;
    max-width: 100%;
    border-radius: 14px 14px 0 0;
    max-height: 90vh;
    height: auto;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
  }

  .filter-group { width: 100%; }
  .filter-group select { flex: 1; }
}

@media (max-width: 480px) {
  .stat-cards { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card .stat-value { font-size: 1.3rem; }

  .balance-card .balance-amount { font-size: 1.6rem; }
  .balance-card .balance-details { flex-direction: column; gap: 5px; }

  .modal-content { padding: 15px; }
}
