﻿:root {
  --bg: #111827;
  --panel: #1f2937;
  --panel-2: #172033;
  --text: #ffffff;
  --muted: #9ca3af;
  --border: #374151;
  --blue: #3b82f6;
  --blue-strong: #2563eb;
  --green: #10b981;
  --red: #ef4444;
  --yellow: #f59e0b;
  --purple: #a855f7;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, sans-serif;
}

button,
input,
select {
  font: inherit;
}

.container {
  width: min(1100px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 48px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 28px;
}

.app-title {
  color: var(--text);
  font-size: 20px;
  font-weight: 800;
  text-decoration: none;
}

.nav-links {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.nav-links a {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 700;
}

.nav-links a:hover,
.nav-links a.active {
  background: var(--blue-strong);
  border-color: var(--blue-strong);
  color: var(--text);
}

main {
  display: grid;
  gap: 16px;
}

.page-header,
.panel,
.card,
.filters {
  background: var(--panel);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.page-header,
.split-panel,
.filters,
.table-meta,
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.page-header {
  padding: 18px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 30px;
  line-height: 1.1;
}

h2 {
  margin-bottom: 12px;
  font-size: 18px;
}

.split-panel h2 {
  margin-bottom: 4px;
}

.muted,
.card small,
.form-message {
  color: var(--muted);
  font-size: 14px;
}

.panel {
  padding: 16px;
}

.health-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 16px;
}

.card {
  padding: 16px;
}

.card span {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.card strong {
  display: block;
  margin-bottom: 6px;
  font-size: 24px;
}

.status-pill,
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 800;
}

.status-pill.online,
.status-success {
  background: rgba(16, 185, 129, 0.18);
  color: #34d399;
}

.status-pill.offline,
.status-failed {
  background: rgba(239, 68, 68, 0.18);
  color: #f87171;
}

.status-skipped {
  background: rgba(245, 158, 11, 0.18);
  color: #fbbf24;
}

.type-masuk {
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
}

.type-pulang {
  background: rgba(168, 85, 247, 0.2);
  color: #c084fc;
}

.button-group,
.form-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.btn {
  border: none;
  border-radius: 8px;
  padding: 10px 14px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  transition: opacity 0.15s ease, background 0.15s ease;
}

.btn:hover {
  opacity: 0.9;
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.btn.primary {
  background: var(--blue-strong);
  color: var(--text);
}

.btn.secondary {
  background: #273449;
  color: var(--text);
}

.btn.danger {
  background: var(--red);
  color: var(--text);
}

.notice,
.form-message:not(:empty) {
  border-left: 3px solid var(--blue);
  border-radius: 8px;
  background: var(--panel);
  padding: 10px 12px;
}

.user-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.user-form label,
.filters label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.form-actions {
  grid-column: 1 / -1;
}

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #111827;
  color: var(--text);
  padding: 10px 12px;
  outline: none;
}

input::placeholder {
  color: #6b7280;
}

input:focus,
select:focus {
  border-color: #60a5fa;
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.18);
}

.filters {
  align-items: end;
  padding: 16px;
  flex-wrap: wrap;
}

.filters label {
  min-width: 160px;
}

.filters .search-field {
  flex: 1;
  min-width: 220px;
}

.table-panel {
  display: grid;
  gap: 12px;
}

.table-wrapper {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
}

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

.data-table th {
  background: #111827;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.data-table tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.logs-table td:last-child {
  max-width: 420px;
  overflow-wrap: anywhere;
}

.row-empty td,
.row-error td {
  color: var(--muted);
  text-align: center;
}

.row-error td {
  color: #f87171;
}

.user-cell strong {
  display: block;
}

.user-cell small {
  color: var(--muted);
}

.log-success {
  box-shadow: inset 3px 0 0 var(--green);
}

.log-failed {
  box-shadow: inset 3px 0 0 var(--red);
}

.log-skipped {
  box-shadow: inset 3px 0 0 var(--yellow);
}

.pagination {
  color: var(--muted);
  font-size: 14px;
}

.pagination span {
  min-width: 110px;
  text-align: center;
}

@media (max-width: 820px) {
  .topbar,
  .page-header,
  .split-panel {
    align-items: stretch;
    flex-direction: column;
  }

  .user-form {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 560px) {
  .container {
    width: min(100% - 20px, 1100px);
    padding-top: 16px;
  }

  .nav-links a,
  .button-group .btn,
  .form-actions .btn,
  .pagination .btn {
    flex: 1;
  }

  .user-form {
    grid-template-columns: 1fr;
  }

  .filters label,
  .filters .search-field {
    min-width: 100%;
  }

  h1 {
    font-size: 26px;
  }
}
