*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: "Poppins", sans-serif;
  transition:
    background 0.3s,
    color 0.3s,
    border-color 0.3s;
}

:root {
  --bg: #f4f6f8;
  --bg2: #ffffff;
  --bg3: #f8fafc;
  --border: #e2e8f0;
  --border2: #cbd5e1;
  --text: #0f172a;
  --muted: #64748b;

  --cyan: #07dce0;
  --cyan-hover: #05b8bb;
  --cyan-dim: rgba(7, 220, 224, 0.1);
  --green: #10b981;
  --red: #ef4444;
  --orange: #f59e0b;

  --radius: 8px;
  --radius-lg: 16px;
}

body.dark {
  --bg: #0f172a;
  --bg2: #1e293b;
  --bg3: #334155;
  --border: #334155;
  --border2: #475569;
  --text: #f8fafc;
  --muted: #94a3b8;
}

body {
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* HEADER & NAV */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.2rem 2rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg2);
  z-index: 10;
}
.logo {
  font-family: "Oswald", sans-serif;
  font-weight: 700;
  font-size: 1.6rem;
  letter-spacing: 0.06em;
}
.logo span {
  color: var(--cyan);
}

.theme-toggle {
  background: var(--bg3);
  border: 1px solid var(--border2);
  color: var(--text);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.top-nav {
  display: flex;
  gap: 1rem;
  padding: 1rem 2rem;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
}
.tab-btn {
  background: transparent;
  border: none;
  padding: 0.8rem 1.5rem;
  font-family: "Poppins", sans-serif;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: all 0.2s;
}
.tab-btn:hover {
  color: var(--text);
}
.tab-btn.active {
  color: var(--cyan);
  border-bottom-color: var(--cyan);
}

/* MAIN & CARDS */
main {
  flex: 1;
  padding: 2rem;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
}
.tab-content {
  display: none;
  animation: fadeIn 0.3s ease;
}
.tab-content.active {
  display: block;
}
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
}
body.dark .card {
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}
.card-title {
  font-family: "Oswald", sans-serif;
  font-weight: 700;
  font-size: 2rem;
  margin-bottom: 0.2rem;
}
.card-sub {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

/* SUMMARY & TABLES */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}
.summary-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
}
.sum-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.sum-val {
  font-family: "Oswald", sans-serif;
  font-size: 3rem;
  font-weight: 700;
  line-height: 1.2;
  margin-top: 0.5rem;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
}
th,
td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}
th {
  font-family: "Oswald", sans-serif;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  font-size: 0.85rem;
}
tbody tr:hover {
  background: var(--bg3);
}

/* BADGES */
.badge {
  padding: 0.3rem 0.8rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  display: inline-block;
}
.badge-wait {
  background: rgba(245, 158, 11, 0.15);
  color: #d97706;
  border: 1px solid rgba(245, 158, 11, 0.3);
}
.badge-process {
  background: var(--cyan-dim);
  color: var(--cyan);
  border: 1px solid var(--cyan);
}
.badge-done {
  background: rgba(16, 185, 129, 0.15);
  color: var(--green);
  border: 1px solid rgba(16, 185, 129, 0.3);
}
.badge-lunas {
  background: var(--text);
  color: var(--bg);
  border: 1px solid var(--text);
}

/* FORM & BUTTONS */
.field {
  margin-bottom: 1.2rem;
}
.field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 0.5rem;
}
.form-input {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 0.8rem 1rem;
  color: var(--text);
  outline: none;
  font-family: "Poppins", sans-serif;
}
.form-input:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 2px var(--cyan-dim);
}

.password-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}
.password-wrapper input {
  padding-right: 2.5rem;
}
.toggle-password {
  position: absolute;
  right: 0.8rem;
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 1.2rem;
  color: var(--muted);
  outline: none;
}

.btn-group {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
}
.btn {
  padding: 0.8rem 1.2rem;
  border-radius: var(--radius);
  font-family: "Oswald", sans-serif;
  font-weight: 500;
  font-size: 0.95rem;
  letter-spacing: 0.05em;
  cursor: pointer;
  border: none;
  text-transform: uppercase;
  text-align: center;
  flex: 1;
}
.btn-primary {
  background: var(--cyan);
  color: #fff;
}
.btn-primary:hover {
  background: var(--cyan-hover);
}
.btn-secondary {
  background: transparent;
  border: 1.5px solid var(--border2);
  color: var(--text);
}
.btn-secondary:hover {
  border-color: var(--muted);
  background: var(--bg3);
}
.btn-action {
  padding: 0.4rem 0.8rem;
  font-size: 0.8rem;
  border-radius: 4px;
}
.btn-reset {
  background: transparent;
  border: 1px solid var(--red);
  color: var(--red);
  border-radius: var(--radius);
  cursor: pointer;
}

/* MODALS */
.modal-overlay,
.login-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(5px);
}
.modal-overlay.active,
.login-overlay.active {
  display: flex;
  animation: fadeIn 0.3s;
}
.modal-content {
  width: 90%;
  max-width: 550px;
  background: var(--bg2);
  display: flex;
  flex-direction: column;
  max-height: 90vh; /* Agar tidak melewati tinggi layar */
  padding: 0;
  overflow: hidden;
}
.login-card {
  width: 90%;
  max-width: 400px;
}

/* Pemecahan Modal agar isinya bisa di-scroll tanpa memotong header/footer tombol */
.modal-header {
  padding: 1.5rem 2rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-body {
  padding: 1.5rem 2rem;
  overflow-y: auto;
  flex: 1;
}
.modal-footer {
  padding: 1.5rem 2rem;
  border-top: 1px solid var(--border);
  margin-top: 0;
  background: var(--bg2);
}

.confirm-block {
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
  margin-bottom: 1rem;
}
.confirm-block h4 {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.8rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
}
.confirm-row {
  display: flex;
  justify-content: space-between;
  padding: 0.3rem 0;
  font-size: 0.9rem;
}
.confirm-row .label {
  color: var(--muted);
}
.confirm-row .val {
  font-weight: 600;
}

footer {
  text-align: center;
  padding: 1rem;
  font-size: 0.75rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
  background: var(--bg2);
  margin-top: auto;
}

/* RESPONSIVE */
@media (max-width: 600px) {
  header {
    padding: 1rem 1.5rem;
  }
  main {
    padding: 1.5rem 1rem;
  }
  .summary-grid {
    grid-template-columns: 1fr;
  }
  .btn-group {
    flex-direction: column;
  }
  .modal-content {
    max-height: 95vh;
  }
  .modal-header,
  .modal-body,
  .modal-footer {
    padding: 1.2rem 1.5rem;
  }
}
