@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700&display=swap');

* { 
  box-sizing: border-box; 
  transition: background-color 0.2s, border-color 0.2s;
}

body {
  margin: 0;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #0b0f19;
  color: #f8fafc;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 16px 80px;
}

header.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
  border-bottom: 1px solid #1e293b;
  padding-bottom: 16px;
}

header.topbar h1 {
  font-size: 24px;
  font-weight: 700;
  margin: 0;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.btn-link {
  font-size: 14px;
  font-weight: 500;
  color: #60a5fa;
  text-decoration: none;
  padding: 8px 16px;
  border-radius: 8px;
  background: rgba(96, 165, 250, 0.08);
  border: 1px solid rgba(96, 165, 250, 0.15);
  transition: all 0.2s ease;
}

.btn-link:hover {
  background: rgba(96, 165, 250, 0.18);
  color: #93c5fd;
  border-color: rgba(96, 165, 250, 0.3);
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.card {
  background: #111827;
  border: 1px solid #1f2937;
  border-radius: 12px;
  padding: 18px 20px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: #3b82f6;
}

.card:nth-child(2)::before { background: #8b5cf6; }
.card:nth-child(3)::before { background: #10b981; }
.card:nth-child(4)::before { background: #f59e0b; }

.card .label { 
  font-size: 11px; 
  color: #9ca3af; 
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.card .value { 
  font-size: 20px; 
  font-weight: 700;
  color: #ffffff;
}

.panel {
  background: #111827;
  border: 1px solid #1f2937;
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.panel h2 { 
  font-size: 18px; 
  font-weight: 600; 
  margin: 0 0 16px;
  color: #f3f4f6;
}

form.inline { 
  display: flex; 
  gap: 12px; 
  align-items: center;
  flex-wrap: wrap; 
}

input[type=text], input[type=number], input[type=password], input[type=date], select {
  padding: 10px 14px;
  background: #1f2937;
  border: 1px solid #374151;
  border-radius: 8px;
  color: #f9fafb;
  font-size: 14px;
  outline: none;
  font-family: inherit;
}

input[type=text]:focus, input[type=number]:focus, input[type=password]:focus, input[type=date]:focus, select:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

button {
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

button:hover { 
  background: #3b82f6; 
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
}

button.secondary { 
  background: #4b5563; 
}
button.secondary:hover { 
  background: #6b7280; 
}

button.danger { 
  background: #dc2626; 
}
button.danger:hover { 
  background: #ef4444; 
}

.flash {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 24px;
  font-size: 14px;
  font-weight: 500;
}
.flash.ok { 
  background: rgba(16, 185, 129, 0.12); 
  color: #34d399; 
  border: 1px solid rgba(16, 185, 129, 0.3);
}
.flash.err { 
  background: rgba(239, 68, 68, 0.12); 
  color: #f87171; 
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.grid-wrap {
  overflow-x: auto;
  border-radius: 12px;
  background: #111827;
  border: 1px solid #1f2937;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  margin-top: 12px;
}

table.kas-grid {
  border-collapse: collapse;
  width: 100%;
  font-size: 13px;
  white-space: nowrap;
}

table.kas-grid th, table.kas-grid td {
  border: 1px solid #1f2937;
  padding: 12px 14px;
  text-align: center;
}

table.kas-grid th {
  background: #1f2937;
  color: #9ca3af;
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 1;
}

table.kas-grid td.name-cell, table.kas-grid th.name-cell {
  text-align: left;
  position: sticky;
  left: 0;
  background: #111827;
  z-index: 2;
  min-width: 160px;
  font-weight: 600;
}

table.kas-grid th.name-cell { 
  background: #1f2937; 
  z-index: 3; 
}

.paid { 
  background: rgba(16, 185, 129, 0.12) !important; 
  color: #34d399; 
  font-weight: 600; 
}

.unpaid { 
  background: transparent; 
  color: #4b5563; 
}

.today-col { 
  background: rgba(59, 130, 246, 0.08) !important; 
  border-left: 2px solid #3b82f6 !important;
  border-right: 2px solid #3b82f6 !important;
}

.pay-form { 
  display: flex; 
  gap: 6px; 
  justify-content: center; 
}
.pay-form input[type=number] { 
  width: 95px; 
  padding: 6px 8px; 
  background: #111827;
}
.pay-form button { 
  padding: 6px 12px; 
  font-size: 13px;
}

.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.badge.lunas { 
  background: rgba(16, 185, 129, 0.15); 
  color: #34d399; 
  border: 1px solid rgba(16, 185, 129, 0.3);
}
.badge.kurang { 
  background: rgba(245, 158, 11, 0.15); 
  color: #fbbf24; 
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.small-note { 
  font-size: 12px; 
  color: #9ca3af; 
  margin-top: 8px; 
}

/* Custom Searchable Dropdown CSS */
.custom-select-container {
  position: relative;
  width: 250px;
}

.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.search-input-wrapper input {
  width: 100%;
  padding-right: 32px;
}

.dropdown-arrow {
  position: absolute;
  right: 12px;
  color: #6b7280;
  font-size: 10px;
  pointer-events: none;
  transition: transform 0.2s ease;
}

.custom-select-container.open .dropdown-arrow {
  transform: rotate(180deg);
}

.custom-select-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 100;
  max-height: 240px;
  overflow-y: auto;
  background: #1f2937;
  border: 1px solid #374151;
  border-radius: 8px;
  margin: 6px 0 0;
  padding: 0;
  list-style: none;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
  display: none;
}

.custom-select-dropdown li {
  padding: 10px 14px;
  cursor: pointer;
  font-size: 14px;
  color: #f3f4f6;
  transition: background-color 0.15s ease;
  text-align: left;
}

.custom-select-dropdown li:hover,
.custom-select-dropdown li.selected {
  background: #374151;
  color: #ffffff;
}

.custom-select-dropdown li.empty-state {
  color: #9ca3af;
  cursor: default;
  text-align: center;
  padding: 12px;
}

/* Mobile Responsiveness Rules */
@media (max-width: 768px) {
  .container {
    padding: 16px 12px 60px;
  }
  
  header.topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 24px;
  }
  
  header.topbar nav {
    width: 100%;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px !important;
  }

  .btn-link {
    font-size: 13px;
    padding: 6px 12px;
  }

  .cards {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 20px;
  }

  .card {
    padding: 12px 14px;
  }

  .card .value {
    font-size: 16px;
  }

  .panel {
    padding: 16px;
    margin-bottom: 16px;
  }

  form.inline {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .custom-select-container, input[type=text], input[type=number], input[type=date], select, button {
    width: 100% !important;
  }
}
