:root {
  color-scheme: light;
  --ink: #153529;
  --muted: #65776e;
  --line: #dfe9e2;
  --surface: #ffffff;
  --canvas: #f4f8f5;
  --green: #287a52;
  --green-dark: #175d3b;
  --green-soft: #e8f5ed;
  --danger: #a02929;
  --shadow: 0 20px 50px rgba(24, 67, 47, 0.12);
}

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

html {
  min-height: 100%;
  background: var(--canvas);
  -webkit-text-size-adjust: 100%;
}

body,
button,
input,
select {
  font: 400 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  min-width: 300px;
  min-height: 100vh;
  color: var(--ink);
  background: var(--canvas);
}

button,
input,
select,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  min-height: 44px;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 700;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(40, 122, 82, 0.25);
  outline-offset: 2px;
}

.auth-page {
  display: grid;
  place-items: center;
  padding: max(20px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right))
    max(20px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
  background:
    linear-gradient(rgba(245, 250, 246, 0.76), rgba(245, 250, 246, 0.92)),
    url("/assets/icon-bali-background.jpg") center / cover fixed;
}

.auth-layout {
  width: min(100%, 920px);
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(330px, 0.95fr);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.85);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

.auth-brand {
  min-height: 540px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px;
  background:
    linear-gradient(145deg, rgba(25, 91, 56, 0.83), rgba(68, 128, 59, 0.72)),
    url("/assets/icon-bali-background.jpg") center / cover;
}

.auth-brand img {
  width: min(100%, 330px);
  height: auto;
  filter: drop-shadow(0 16px 24px rgba(9, 41, 25, 0.28));
}

.auth-brand p {
  margin-top: 18px;
  color: rgba(255, 255, 255, 0.92);
  font-size: 15px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.auth-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(32px, 6vw, 58px);
  background: rgba(255, 255, 255, 0.97);
}

.eyebrow {
  display: block;
  margin-bottom: 7px;
  color: var(--green);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1 {
  font-size: clamp(27px, 4vw, 38px);
  line-height: 1.15;
  letter-spacing: -0.025em;
}

.auth-card-heading p,
.page-heading p {
  margin-top: 9px;
  color: var(--muted);
}

.auth-card form {
  margin-top: 30px;
}

.auth-card label {
  display: block;
  margin: 14px 0 7px;
  font-size: 13px;
  font-weight: 750;
}

.auth-card input,
.search-control input,
.page-size-control select {
  width: 100%;
  min-height: 48px;
  border: 1px solid #cbdad0;
  border-radius: 10px;
  color: var(--ink);
  background: #fff;
  outline: none;
}

.auth-card input {
  padding: 11px 13px;
  font-size: 16px;
}

.auth-card input:focus,
.search-control input:focus,
.page-size-control select:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 4px rgba(40, 122, 82, 0.12);
}

.auth-card button {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  margin-top: 19px;
  color: #fff;
  background: var(--green);
}

.auth-card button:hover {
  background: var(--green-dark);
}

.auth-card button:disabled {
  cursor: wait;
  opacity: 0.7;
}

.spinner {
  display: none;
  width: 17px;
  height: 17px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.is-loading .spinner {
  display: block;
}

.form-error {
  min-height: 21px;
  margin-top: 10px;
  color: var(--danger);
  font-size: 12px;
}

.topbar {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 10px max(24px, calc((100vw - 1200px) / 2));
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.topbar-brand img {
  width: 52px;
  height: 52px;
  object-fit: contain;
}

.topbar-brand strong,
.topbar-brand small {
  display: block;
}

.topbar-brand strong {
  font-size: 16px;
}

.topbar-brand small {
  color: var(--muted);
  font-size: 11px;
}

.secondary-button {
  padding: 8px 15px;
  border: 1px solid #cbdad0;
  color: var(--ink);
  background: #fff;
}

.secondary-button:hover:not(:disabled) {
  border-color: var(--green);
  color: var(--green-dark);
}

.secondary-button:disabled {
  cursor: default;
  opacity: 0.45;
}

.dashboard-shell {
  width: min(100%, 1200px);
  margin: 0 auto;
  padding: 38px 24px 60px;
}

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 28px;
}

.stat-card,
.member-panel {
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(28, 74, 52, 0.055);
}

.stat-card {
  padding: 20px;
  border-radius: 15px;
}

.stat-card span,
.page-size-control span,
.search-control span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.stat-card strong {
  display: block;
  margin-top: 6px;
  font-size: 28px;
  line-height: 1.1;
}

.member-panel {
  margin-top: 20px;
  overflow: hidden;
  border-radius: 16px;
}

.member-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 19px 20px;
  border-bottom: 1px solid var(--line);
}

.search-control {
  width: min(100%, 430px);
}

.search-control input {
  margin-top: 6px;
  padding: 9px 12px;
}

.page-size-control {
  min-width: 88px;
}

.page-size-control select {
  margin-top: 6px;
  padding: 8px 30px 8px 10px;
}

.member-feedback {
  padding: 44px 20px;
  color: var(--muted);
  text-align: center;
}

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

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 14px 20px;
  border-bottom: 1px solid #e9efeb;
  text-align: left;
  white-space: nowrap;
}

th {
  color: var(--muted);
  background: #f8faf8;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

td {
  font-size: 13px;
}

.member-name {
  font-weight: 750;
}

tbody tr:hover {
  background: #fbfdfb;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
}

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

.pagination-actions {
  display: flex;
  gap: 8px;
}

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

@media (max-width: 720px) {
  .auth-page {
    display: block;
    padding: 0;
  }

  .auth-layout {
    min-height: 100vh;
    min-height: 100svh;
    display: block;
    border: 0;
    border-radius: 0;
  }

  .auth-brand {
    min-height: 220px;
    padding: 28px 24px;
  }

  .auth-brand img {
    width: min(72%, 250px);
    max-height: 170px;
  }

  .auth-brand p {
    display: none;
  }

  .auth-card {
    min-height: calc(100svh - 220px);
    justify-content: flex-start;
    padding: 32px 24px max(32px, env(safe-area-inset-bottom));
  }

  .topbar {
    min-height: 66px;
    padding: 8px 16px;
  }

  .topbar-brand img {
    width: 44px;
    height: 44px;
  }

  .dashboard-shell {
    padding: 26px 14px 40px;
  }

  .page-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .stat-grid {
    grid-template-columns: 1fr;
    gap: 10px;
    margin-top: 22px;
  }

  .stat-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 17px;
  }

  .stat-card strong {
    margin: 0;
    font-size: 24px;
  }

  .member-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .page-size-control {
    width: 100%;
  }

  .table-scroll {
    overflow: visible;
  }

  table,
  tbody,
  tr,
  td {
    display: block;
    width: 100%;
  }

  thead {
    display: none;
  }

  tbody tr {
    padding: 13px 16px;
    border-bottom: 1px solid var(--line);
  }

  td {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    padding: 5px 0;
    border: 0;
    white-space: normal;
    overflow-wrap: anywhere;
    text-align: right;
  }

  td::before {
    content: attr(data-label);
    flex: 0 0 auto;
    color: var(--muted);
    font-size: 11px;
    font-weight: 750;
    text-transform: uppercase;
  }

  .member-name {
    font-size: 15px;
  }

  .pagination {
    align-items: stretch;
    flex-direction: column;
  }

  .pagination-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
}
