* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: #f4f6f9;
  color: #1f2937;
  font-size: 14px;
}

.wrap {
  max-width: 1280px;
  margin: 0 auto;
  padding: 20px;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}

h1 {
  font-size: 22px;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  vertical-align: middle;
}
h1 .icon {
  width: 22px;
  height: 22px;
}
button .icon {
  width: 15px;
  height: 15px;
}
button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

button {
  border: none;
  padding: 9px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: all .15s;
}

.btn-primary {
  background: #2563eb;
  color: #fff;
}
.btn-primary:hover {
  background: #1d4ed8;
}

.btn-secondary {
  background: #e5e7eb;
  color: #1f2937;
}
.btn-secondary:hover {
  background: #d1d5db;
}

.btn-danger {
  background: #ef4444;
  color: #fff;
  padding: 6px 8px;
  font-size: 12px;
}
.btn-danger:hover {
  background: #dc2626;
}
.btn-danger .icon {
  width: 14px;
  height: 14px;
}

.btn-add {
  background: #10b981;
  color: #fff;
  padding: 6px 12px;
  font-size: 12px;
}
.btn-add:hover {
  background: #059669;
}

.filter-bar {
  background: #eef4ff;
  border: 1px solid #c7d8f8;
  padding: 14px 18px;
  border-radius: 10px;
  margin-bottom: 16px;
  display: flex;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
  box-shadow: 0 1px 3px rgba(37, 99, 235, .08);
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #fff;
  border: 1px solid #d8e3fa;
  padding: 4px 10px 4px 12px;
  border-radius: 8px;
}

.filter-group label {
  font-size: 13px;
  font-weight: 600;
  color: #1e40af;
  white-space: nowrap;
}

.filter-bar input[type="month"] {
  padding: 5px 8px;
  border: 1px solid transparent;
  border-radius: 5px;
  font-size: 13px;
  background: transparent;
}
.filter-bar input[type="month"]:focus {
  outline: none;
  border-color: #2563eb;
  background: #fff;
}

.filter-checkbox {
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  color: #1e40af;
  background: #fff;
  border: 1px solid #d8e3fa;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
}
.filter-checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: #2563eb;
}

/* ===== Ringkasan per Kategori ===== */
#summary {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.summary-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 12px 14px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .06);
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-left: 4px solid var(--grup-color, #9ca3af);
}
.summary-card .summary-title {
  font-size: 13px;
  font-weight: 700;
  color: #1f2937;
  display: flex;
  align-items: center;
  gap: 6px;
  line-height: 1.3;
}
.summary-card .summary-title .grup-badge {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--grup-color, #9ca3af);
  flex-shrink: 0;
}
.summary-card .summary-number {
  font-size: 24px;
  font-weight: 800;
  color: var(--grup-color, #2563eb);
  line-height: 1;
}
.summary-card .summary-number small {
  font-size: 11px;
  font-weight: 600;
  color: #6b7280;
  margin-left: 4px;
}
.summary-card .summary-sub {
  font-size: 11px;
  color: #6b7280;
}
.summary-empty {
  background: transparent;
  border: none;
  box-shadow: none;
}

.card {
  background: #fff;
  border-radius: 10px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .06);
  overflow: hidden;
  border: 1px solid #e5e7eb;
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 18px;
  background: #f8fafc;
  border-bottom: 1px solid #e5e7eb;
}

.card-head .date {
  font-weight: 700;
  font-size: 15px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.card-head .date .icon {
  width: 16px;
  height: 16px;
  color: #2563eb;
}

.card-head .meta {
  font-size: 12px;
  color: #6b7280;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th {
  text-align: left;
  padding: 8px 10px;
  background: #f9fafb;
  font-weight: 600;
  color: #4b5563;
  border-bottom: 1px solid #e5e7eb;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .03em;
}

td {
  padding: 6px 8px;
  border-bottom: 1px solid #f3f4f6;
  vertical-align: top;
}

td input[type="text"],
td select,
td textarea {
  width: 100%;
  padding: 7px 9px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  background: #f8fafc;
  color: #1f2937;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
td input[type="text"]:hover,
td select:hover,
td textarea:hover {
  border-color: #9ca3af;
  background: #fff;
}
td input[type="text"]:focus,
td select:focus,
td textarea:focus {
  border-color: #2563eb;
  background: #fff;
  outline: none;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .15);
}

td textarea.cell-textarea {
  resize: none;
  overflow: hidden;
  min-height: 34px;
  line-height: 1.4;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.custom-select {
  position: relative;
  width: 100%;
}
.custom-select-trigger {
  width: 100%;
  padding: 7px 26px 7px 9px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #f8fafc;
  font-size: 13px;
  font-family: inherit;
  text-align: left;
  color: #1f2937;
  cursor: pointer;
  position: relative;
  transition: border-color .15s, background .15s, box-shadow .15s;
  display: flex;
  align-items: center;
  gap: 6px;
}
.custom-select-trigger:hover {
  border-color: #9ca3af;
  background: #fff;
}
.custom-select-trigger:focus,
.custom-select.open .custom-select-trigger {
  border-color: #2563eb;
  background: #fff;
  outline: none;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .15);
}
.custom-select-trigger.placeholder {
  color: #9ca3af;
}
.custom-select-trigger::after {
  content: "";
  position: absolute;
  right: 10px;
  top: 50%;
  width: 6px;
  height: 6px;
  border-right: 1.6px solid #6b7280;
  border-bottom: 1.6px solid #6b7280;
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}

.grup-badge {
  flex-shrink: 0;
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #9ca3af;
}

.custom-select-menu {
  position: fixed;
  z-index: 2000;
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, .12);
  padding: 4px;
  min-width: 200px;
  max-height: 340px;
  overflow-y: auto;
  display: none;
}
.custom-select-menu.show {
  display: block;
}

.custom-select-search {
  position: sticky;
  top: -4px;
  background: #fff;
  padding: 4px 4px 6px;
  margin-bottom: 2px;
  z-index: 2;
}
.custom-select-search input {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  background: #f8fafc;
}
.custom-select-search input:focus {
  outline: none;
  border-color: #2563eb;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .15);
}

.custom-select-group-label {
  padding: 8px 10px 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--grup-color, #6b7280);
  background: #fff;
  position: sticky;
  top: 40px;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 6px;
}
.custom-select-group-label::before {
  content: "";
  width: 4px;
  height: 12px;
  border-radius: 2px;
  background: var(--grup-color, #9ca3af);
}

.custom-select-option {
  padding: 7px 10px;
  font-size: 13px;
  border-radius: 5px;
  cursor: pointer;
  white-space: nowrap;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.custom-select-option:hover {
  background: #eff6ff;
  color: #1d4ed8;
}
.custom-select-option.selected {
  background: #dbeafe;
  color: #1d4ed8;
  font-weight: 600;
}
.custom-select-option.is-empty {
  color: #9ca3af;
  font-style: italic;
}
.custom-select-option-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
}
.custom-select-option-del {
  flex-shrink: 0;
  border: none;
  background: transparent;
  color: #ef4444;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
}
.custom-select-option-del:hover {
  background: #fee2e2;
}
.custom-select-option-del .icon {
  width: 12px;
  height: 12px;
}

.custom-select-divider {
  height: 1px;
  background: #e5e7eb;
  margin: 4px 2px;
}

.custom-select-action {
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 600;
  color: #2563eb;
  cursor: pointer;
  border-radius: 5px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.custom-select-action:hover {
  background: #eff6ff;
}

.filter-select {
  width: auto;
  min-width: 130px;
}
.filter-select .custom-select-trigger {
  padding: 5px 26px 5px 8px;
  border: 1px solid transparent;
  background: transparent;
  min-width: 130px;
}
.filter-select .custom-select-trigger:hover {
  border-color: #d8e3fa;
  background: #fff;
}
.filter-select .custom-select-trigger:focus,
.filter-select.open .custom-select-trigger {
  border-color: #2563eb;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .15);
}

.status-cell {
  text-align: center;
  width: 70px;
}
.status-cell input[type="checkbox"] {
  width: 22px;
  height: 22px;
  cursor: pointer;
  accent-color: #2563eb;
}

.row-actions {
  width: 60px;
  text-align: right;
}

.empty-state {
  text-align: center;
  padding: 40px;
  color: #9ca3af;
  background: #fff;
  border-radius: 10px;
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: #1f2937;
  color: #fff;
  padding: 12px 22px;
  border-radius: 8px;
  font-size: 13px;
  opacity: 0;
  transition: all .3s;
  z-index: 999;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.toast.error {
  background: #dc2626;
}
.toast.success {
  background: #059669;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .45);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.modal-overlay.show {
  display: flex;
}
.modal {
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  width: 420px;
  max-width: 92vw;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .2);
}
.modal h3 {
  margin: 0 0 16px;
  font-size: 17px;
}
.modal label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
}
.modal input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #d1d5db;
  border-radius: 7px;
  font-size: 14px;
  margin-bottom: 16px;
}
.modal input:focus {
  border-color: #2563eb;
  outline: none;
}
.modal-btns {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}