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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  color: #1a1a1a;
  background: #f4f5f7;
  min-height: 100vh;
}

header {
  background: #1e3a5f;
  color: #fff;
  padding: 16px 24px;
}
header h1 { font-size: 18px; font-weight: 600; }
header span { font-size: 12px; opacity: 0.65; }

.container { width: 100%; padding: 14px 16px; }

/* Cards */
.card {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,.1);
  margin-bottom: 14px;
}
.card-head {
  padding: 14px 20px;
  border-bottom: 1px solid #eee;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
}
.card-head h2 { font-size: 13px; font-weight: 600; color: #444; text-transform: uppercase; letter-spacing: .4px; }
.card-head .chevron { transition: transform .2s; font-size: 12px; color: #888; }
.card-head.collapsed .chevron { transform: rotate(-90deg); }
.card-body { padding: 18px 20px; }
.card-body.hidden { display: none; }

/* Filter row */
.filter-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 190px; flex: 1; }
.field label { font-size: 11px; font-weight: 600; color: #666; text-transform: uppercase; letter-spacing: .4px; }

/* Universal select style */
select {
  height: 36px;
  padding: 0 28px 0 10px;
  border: 1px solid #d0d5dd;
  border-radius: 6px;
  background: #fff;
  font-size: 13px;
  color: #1a1a1a;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23888' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  width: 100%;
}
select:focus { outline: none; border-color: #1e3a5f; box-shadow: 0 0 0 3px rgba(30,58,95,.12); }
select:disabled { background: #f9f9f9; color: #aaa; cursor: not-allowed; }

/* Buttons */
.btn {
  height: 36px; padding: 0 16px; border: none; border-radius: 6px;
  font-size: 13px; font-weight: 500; cursor: pointer; white-space: nowrap;
  transition: opacity .15s, background .15s;
}
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn-primary  { background: #1e3a5f; color: #fff; }
.btn-primary:not(:disabled):hover  { background: #16305a; }
.btn-success  { background: #1a7f4b; color: #fff; }
.btn-success:not(:disabled):hover  { background: #156640; }
.btn-excel    { background: #217346; color: #fff; }
.btn-excel:not(:disabled):hover    { background: #1a5e38; }
.btn-ghost    { background: transparent; color: #555; border: 1px solid #d0d5dd; }
.btn-ghost:not(:disabled):hover    { background: #f3f4f6; }
.btn-link     { background: none; border: none; color: #1e3a5f; text-decoration: underline; font-size: 12px; cursor: pointer; padding: 0; height: auto; }

/* Column picker */
.col-picker-toolbar {
  display: flex; gap: 8px; align-items: center; margin-bottom: 14px; flex-wrap: wrap;
}
.col-picker-toolbar span { font-size: 12px; color: #888; margin-right: 4px; }
.selected-count { font-size: 12px; color: #1e3a5f; font-weight: 600; margin-left: auto; }

.groups-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}
.group-box {
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  overflow: hidden;
}
.group-head {
  background: #f8f9fa;
  padding: 8px 12px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid #e5e7eb;
}
.group-head strong { font-size: 12px; font-weight: 600; color: #444; }
.group-actions { display: flex; gap: 6px; }
.group-actions button {
  font-size: 11px; color: #1e3a5f; background: none; border: none;
  cursor: pointer; padding: 0; text-decoration: underline; line-height: 1;
}
.group-cols { padding: 8px 10px; display: flex; flex-direction: column; gap: 5px; }
.col-item { display: flex; align-items: flex-start; gap: 7px; cursor: pointer; }
.col-item input[type=checkbox] { margin-top: 2px; accent-color: #1e3a5f; cursor: pointer; flex-shrink: 0; }
.col-item-text { display: flex; flex-direction: column; }
.col-item-label { font-size: 12px; color: #1a1a1a; line-height: 1.3; }
.col-item-hint  { font-size: 11px; color: #999; margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 190px; }

/* Stats bar */
.stats-bar {
  display: none;
  background: #fff;
  border-radius: 8px;
  padding: 12px 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,.1);
  margin-bottom: 14px;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}
.stats-bar.visible { display: flex; }
.stat { display: flex; flex-direction: column; }
.stat-label { font-size: 11px; color: #888; text-transform: uppercase; letter-spacing: .3px; }
.stat-value { font-size: 22px; font-weight: 700; color: #1e3a5f; line-height: 1.1; }
.export-btns { display: flex; gap: 8px; margin-left: auto; }

/* Table */
.table-wrap { overflow-x: auto; max-height: calc(100vh - 340px); min-height: 280px; overflow-y: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
thead th {
  position: sticky; top: 0; background: #f8f9fa;
  padding: 9px 12px; text-align: left; font-weight: 600;
  font-size: 11px; text-transform: uppercase; letter-spacing: .4px; color: #555;
  border-bottom: 1px solid #e2e5e9; white-space: nowrap;
}
tbody td {
  padding: 8px 12px; border-bottom: 1px solid #f0f0f0;
  white-space: nowrap; max-width: 200px; overflow: hidden; text-overflow: ellipsis;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #f5f8ff; }

.cell-mono { font-family: 'SF Mono', 'Courier New', monospace; font-size: 11px; }
.badge { display: inline-block; padding: 2px 7px; border-radius: 99px; font-size: 11px; font-weight: 600; text-transform: capitalize; }
.badge-green { background: #dcfce7; color: #15803d; }
.badge-blue  { background: #dbeafe; color: #1d4ed8; }
.badge-gray  { background: #f3f4f6; color: #6b7280; }
.badge-amber { background: #fef3c7; color: #b45309; }

/* States */
.state-box { padding: 48px 20px; text-align: center; color: #bbb; }
.state-box p { font-size: 13px; margin-top: 8px; }
.state-box p.sub { font-size: 12px; color: #ccc; margin-top: 4px; }
.spinner {
  display: inline-block; width: 28px; height: 28px;
  border: 3px solid #e5e7eb; border-top-color: #1e3a5f;
  border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.error-msg {
  background: #fef2f2; border: 1px solid #fecaca; color: #b91c1c;
  border-radius: 6px; padding: 10px 14px; font-size: 12px;
  margin-bottom: 12px; display: none;
}
.error-msg.visible { display: block; }

.preview-note { font-size: 12px; color: #999; }
.table-toolbar { padding: 12px 20px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid #eee; }
.table-toolbar h2 { font-size: 13px; font-weight: 600; color: #444; }

/* Sectioned filter layout */
.filter-sections { display: flex; flex-direction: column; gap: 18px; }
.filter-section  { display: flex; flex-direction: column; gap: 8px; }
.filter-section-label {
  font-size: 11px; font-weight: 700; color: #888;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.filter-divider { border: none; border-top: 1px solid #eee; margin: 2px 0; }

/* Category tabs */
.type-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.type-tab {
  height: 32px; padding: 0 14px; border-radius: 6px;
  border: 1px solid #d0d5dd; background: #fff;
  font-size: 12px; font-weight: 500; cursor: pointer; color: #555;
  transition: background .12s, border-color .12s, color .12s;
}
.type-tab.active { background: #1e3a5f; border-color: #1e3a5f; color: #fff; }
.type-tab:hover:not(.active) { background: #f3f4f6; }

/* Payment item checkboxes */
.payment-items-wrap { margin-top: 2px; }
.payment-items-hint { font-size: 11px; color: #aaa; margin-bottom: 6px; }
.payment-items-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.payment-item-check {
  display: inline-flex; align-items: flex-start; gap: 8px;
  background: #f8f9fa; border: 1px solid #e5e7eb;
  border-radius: 6px; padding: 8px 12px; cursor: pointer;
  transition: background .12s, border-color .12s;
}
.payment-item-check:hover { background: #f0f4ff; border-color: #c7d7f4; }
.payment-item-check.selected { background: #eff6ff; border-color: #93c5fd; }
.payment-item-check input[type=checkbox] { accent-color: #1e3a5f; cursor: pointer; flex-shrink: 0; margin-top: 2px; }
.payment-item-inner { display: flex; flex-direction: column; gap: 2px; }
.payment-item-label { font-size: 12px; font-weight: 500; color: #1a1a1a; line-height: 1.3; }
.payment-item-meta  { font-size: 11px; color: #888; }

/* Price tags inside payment item cards */
.payment-item-prices { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
.price-tag {
  display: inline-block; font-size: 10px; font-weight: 600;
  padding: 1px 6px; border-radius: 4px; line-height: 1.6;
  font-family: 'SF Mono', 'Courier New', monospace;
}
.price-tag-idr { background: #fef3c7; color: #92400e; }
.price-tag-usd { background: #dcfce7; color: #166534; }

/* Participant filter groups */
.participant-filter-groups { display: flex; flex-direction: column; gap: 14px; }
.participant-filter-group { display: flex; flex-direction: column; gap: 6px; }
.participant-filter-group-label {
  font-size: 11px; font-weight: 600; color: #aaa;
  text-transform: uppercase; letter-spacing: 0.4px;
}

/* Participant filter row */
.participant-filter-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }

/* Filter actions */
.filter-actions { display: flex; justify-content: flex-end; padding-top: 4px; }
