:root {
  color-scheme: light;
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-alt: #f8fbff;
  --text: #132238;
  --muted: #5f6b7a;
  --primary: #1d6fe0;
  --primary-dark: #1557b3;
  --border: #dbe4ef;
  --shadow: 0 10px 30px rgba(19, 34, 56, 0.08);
  --success: #1e8e3e;
  --danger: #d64545;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, sans-serif;
  background:
    radial-gradient(circle at top, rgba(29, 111, 224, 0.08), transparent 34%),
    var(--bg);
  color: var(--text);
}

.page-loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background:
    radial-gradient(circle at 20% 20%, rgba(29, 111, 224, 0.18), transparent 30%),
    radial-gradient(circle at 80% 30%, rgba(70, 179, 255, 0.16), transparent 28%),
    linear-gradient(180deg, rgba(245, 248, 252, 0.88), rgba(236, 242, 250, 0.96));
  backdrop-filter: blur(12px);
}

.page-loading-card {
  width: min(100%, 420px);
  padding: 28px 24px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(219, 228, 239, 0.9);
  box-shadow: 0 24px 60px rgba(19, 34, 56, 0.18);
  text-align: center;
}

.page-loading-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  color: var(--text);
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.page-loading-spinner {
  width: 76px;
  height: 76px;
  margin: 0 auto 18px;
  border-radius: 50%;
  border: 6px solid rgba(29, 111, 224, 0.12);
  border-top-color: var(--primary);
  border-right-color: rgba(70, 179, 255, 0.7);
  animation: spin 1s linear infinite;
}

.page-loading-card p {
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.5;
}

.page-loading-bar {
  width: 100%;
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(19, 34, 56, 0.08);
}

.page-loading-bar span {
  display: block;
  width: 38%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), #46b3ff, var(--primary));
  animation: loading-slide 1.4s ease-in-out infinite;
}

.page-loading-overlay.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 16px 32px;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 8px;
  font-size: 1.7rem;
  line-height: 1.15;
}

.subtitle {
  margin-bottom: 16px;
  color: var(--muted);
  max-width: 42rem;
}

.toolbar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

button {
  width: 100%;
  padding: 12px 16px;
  cursor: pointer;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  font-weight: 700;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, opacity 0.15s ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
}

button:disabled {
  opacity: 0.7;
  cursor: progress;
}

.loading-indicator {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  min-height: 24px;
  font-size: 0.95rem;
}

.spinner {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(29, 111, 224, 0.2);
  border-top-color: var(--primary);
  animation: spin 0.8s linear infinite;
  flex: 0 0 auto;
}

.is-hidden {
  display: none !important;
}

.cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 24px;
}

.card {
  background: var(--surface);
  padding: 16px;
  border-radius: 16px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(219, 228, 239, 0.8);
}

.analytics {
  margin-bottom: 24px;
}

.analytics-header {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

.analytics-header h2 {
  margin: 0 0 6px;
}

.segmented-control {
  display: inline-flex;
  gap: 8px;
  padding: 4px;
  background: var(--surface-alt);
  border-radius: 999px;
  align-self: flex-start;
}

.segment {
  width: auto;
  min-width: 0;
  padding: 10px 14px;
  border-radius: 999px;
  box-shadow: none;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
}

.segment:hover:not(:disabled) {
  transform: none;
}

.segment.is-active {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
}

.filters {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 16px;
  padding: 14px;
  border-radius: 14px;
  background: var(--surface-alt);
  border: 1px solid rgba(219, 228, 239, 0.8);
}

.filter-group {
  display: grid;
  gap: 8px;
  font-size: 0.92rem;
  color: var(--muted);
}

.filter-group span {
  font-weight: 700;
  color: var(--text);
}

.filter-group select {
  width: 100%;
  padding: 11px 12px;
  border-radius: 12px;
  border: 1px solid rgba(219, 228, 239, 0.9);
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.choices {
  margin-bottom: 0;
  font-size: 0.95rem;
}

.choices__inner {
  min-height: 44px;
  padding: 6px 12px 6px 12px;
  border-radius: 12px;
  border: 1px solid rgba(219, 228, 239, 0.95);
  background: linear-gradient(180deg, #ffffff, #f7fbff);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
  display: flex;
  align-items: center;
}

.choices[data-type*="select-one"]::after {
  right: 14px;
  margin-top: -3px;
  border-color: var(--muted) transparent transparent;
}

.choices.is-open .choices__inner,
.choices.is-focused .choices__inner {
  border-color: rgba(29, 111, 224, 0.4);
  box-shadow: 0 0 0 4px rgba(29, 111, 224, 0.1);
}

.choices__list--dropdown,
.choices__list[aria-expanded] {
  border-radius: 14px;
  border: 1px solid rgba(219, 228, 239, 0.95);
  box-shadow: 0 18px 40px rgba(19, 34, 56, 0.16);
  overflow: hidden;
}

.choices__list--dropdown .choices__item--selectable {
  padding: 10px 14px;
}

.choices__list--dropdown .choices__item--selectable.is-highlighted {
  background: rgba(29, 111, 224, 0.08);
}

.choices__item--selectable {
  color: var(--text);
}

.choices__placeholder {
  opacity: 0.75;
}

.choices__item--choice.is-selected {
  background: rgba(29, 111, 224, 0.08);
}

.choices__list--single {
  padding: 0;
  display: flex;
  align-items: center;
  min-height: 100%;
}

.choices__item--single {
  padding-right: 24px;
  line-height: 1.2;
}

.filter-reset {
  width: 100%;
  min-width: 0;
  background: white;
  color: var(--primary-dark);
  border: 1px solid rgba(29, 111, 224, 0.18);
  box-shadow: none;
}

.filter-reset:hover:not(:disabled) {
  transform: translateY(-1px);
}

.analytics-summary {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.summary-item {
  padding: 14px;
  border-radius: 14px;
  background: var(--surface-alt);
  border: 1px solid rgba(219, 228, 239, 0.8);
}

.summary-item span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.92rem;
}

.summary-item strong {
  font-size: 1.2rem;
}

.chart {
  display: grid;
  gap: 12px;
}

.chart-empty {
  padding: 20px;
  border-radius: 14px;
  background: var(--surface-alt);
  color: var(--muted);
}

.chart-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}

.chart-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.95rem;
}

.chart-label {
  font-weight: 700;
  color: var(--text);
}

.chart-value {
  color: var(--muted);
  white-space: nowrap;
}

.chart-track {
  height: 14px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(19, 34, 56, 0.08);
}

.chart-bar {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), #46b3ff);
}

.card h3 {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.card-value {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
}

h2 {
  font-size: 1.2rem;
  margin: 24px 0 12px;
}

.table-wrap {
  overflow-x: auto;
  border-radius: 16px;
  box-shadow: var(--shadow);
  background: var(--surface);
  border: 1px solid rgba(219, 228, 239, 0.8);
  margin-bottom: 28px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

th {
  background: var(--surface-alt);
  color: var(--text);
  font-size: 0.9rem;
  position: sticky;
  top: 0;
}

.masuk {
  color: var(--success);
  font-weight: bold;
}

.keluar {
  color: var(--danger);
  font-weight: bold;
}

.layout-note {
  color: var(--muted);
  font-size: 0.92rem;
  margin-bottom: 16px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes loading-slide {
  0% {
    transform: translateX(-120%);
  }

  50% {
    transform: translateX(90%);
  }

  100% {
    transform: translateX(260%);
  }
}

@media (min-width: 720px) {
  .page {
    padding: 32px 28px 40px;
  }

  h1 {
    font-size: 2.3rem;
  }

  .toolbar {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  button {
    width: auto;
    min-width: 160px;
  }

  .cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .analytics-header {
    flex-direction: row;
    align-items: flex-start;
    justify-content: space-between;
  }

  .analytics-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .filters {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    align-items: end;
  }

  .filter-reset {
    height: 43px;
  }
}

@media (min-width: 1024px) {
  .cards {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
