:root {
  color-scheme: light;
  --bg: #f5f7f4;
  --panel: #ffffff;
  --text: #16211d;
  --muted: #60716a;
  --border: #d9e1dc;
  --primary: #0d5c46;
  --primary-strong: #094333;
  --accent: #f1b642;
  --danger: #b42318;
}

* {
  box-sizing: border-box;
}

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

a {
  color: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 20px;
  justify-content: space-between;
  padding: 14px clamp(16px, 4vw, 40px);
  background: rgba(245, 247, 244, 0.94);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(14px);
}

.brand,
.brand-block {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  font-weight: 800;
}

.brand-logo {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
}

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

.nav-link {
  padding: 9px 12px;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.95rem;
}

.nav-link.active,
.nav-link:hover {
  color: var(--primary);
  background: #e7f1ed;
  border-color: #c7ded5;
}

.page {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 28px clamp(16px, 4vw, 40px) 48px;
}

.page-heading {
  margin-bottom: 20px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  line-height: 1.15;
}

h1 {
  font-size: clamp(2rem, 5vw, 3.4rem);
}

h2 {
  margin-bottom: 16px;
  font-size: 1.15rem;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 14px 34px rgba(22, 33, 29, 0.07);
  padding: clamp(18px, 3vw, 24px);
}

.grid {
  display: grid;
  gap: 18px;
  margin-bottom: 18px;
}

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

.stack,
.form-grid {
  display: grid;
  gap: 10px;
}

.form-grid {
  grid-template-columns: minmax(130px, max-content) minmax(160px, 1fr);
  align-items: center;
}

label {
  color: var(--muted);
  font-weight: 700;
  font-size: 0.92rem;
}

input,
select {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 11px;
  background: #fbfdfb;
  color: var(--text);
  font: inherit;
}

input:focus,
select:focus {
  border-color: var(--primary);
  outline: 3px solid rgba(13, 92, 70, 0.14);
}

.checkline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.checkline input {
  width: 18px;
  min-height: 18px;
}

button {
  min-width: 0;
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  padding: 9px 14px;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
}

button:hover {
  background: var(--primary-strong);
}

button.secondary {
  background: #e7f1ed;
  color: var(--primary);
}

button.secondary:hover {
  background: #d8e9e2;
}

button.danger {
  background: #fff0ee;
  color: var(--danger);
}

button.danger:hover {
  background: #ffdeda;
}

.inline-form {
  margin: 0;
}

.inline-form button {
  width: 100%;
}

.alert {
  margin: 0 0 18px;
  padding: 12px 14px;
  border: 1px solid #f4b8b0;
  border-radius: 8px;
  background: #fff4f2;
  color: var(--danger);
  font-weight: 700;
}

.notice {
  margin: 0 0 18px;
  padding: 12px 14px;
  border: 1px solid #b8d8ca;
  border-radius: 8px;
  background: #edf8f3;
  color: var(--primary);
  font-weight: 800;
}

.table-wrap {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: visible;
}

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

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

th {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.product-list {
  display: grid;
  gap: 10px;
}

.user-list,
.pending-list {
  display: grid;
  gap: 10px;
}

.product-row,
.user-row,
.pending-row {
  display: grid;
  gap: 10px;
  align-items: center;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fbfdfb;
}

.product-row {
  grid-template-columns: 56px minmax(150px, 1fr) minmax(96px, 0.35fr) 86px 110px 96px;
}

.user-row {
  grid-template-columns: 48px minmax(130px, 1.1fr) minmax(130px, 0.9fr) minmax(116px, 0.7fr) 80px minmax(112px, 0.8fr) 108px 96px;
}

.pending-row {
  grid-template-columns: minmax(220px, 1fr) minmax(180px, 0.6fr) 120px;
}

.muted {
  color: var(--muted);
  font-weight: 800;
}

.device-chip {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pending-row strong,
.pending-row .muted,
td {
  overflow-wrap: anywhere;
}

.empty-state {
  margin: 0;
  color: var(--muted);
}

.payments-table {
  min-width: 0;
  table-layout: fixed;
}

.payments-table th,
.payments-table td {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.payment-id {
  display: block;
  margin-top: 4px;
  font-size: 0.78rem;
}

.secondary-link {
  color: var(--primary);
  font-weight: 800;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

.badge {
  display: inline-flex;
  align-items: center;
  margin-top: 6px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #e7f1ed;
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 900;
}

.refund-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-width: 0;
}

.account-panel {
  max-width: 560px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.landing-page {
  min-height: 100vh;
  display: grid;
  grid-template-rows: 1fr auto;
}

.landing-shell {
  width: min(720px, 100%);
  margin: 0 auto;
  display: grid;
  align-content: center;
  padding: clamp(20px, 7vw, 64px) clamp(16px, 4vw, 40px);
}

.landing-panel {
  display: grid;
  gap: 24px;
  padding: clamp(22px, 4vw, 36px);
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 18px 42px rgba(22, 33, 29, 0.08);
}

.landing-logo {
  width: 56px;
  height: 56px;
}

.landing-copy {
  margin: 0;
  color: var(--muted);
  font-size: 1.12rem;
  line-height: 1.55;
}

.landing-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.button-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 10px 16px;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  font-weight: 900;
  text-decoration: none;
}

.button-link:hover {
  background: var(--primary-strong);
}

.auth-shell {
  width: min(440px, 100%);
}

.auth-panel {
  padding: 28px;
}

.auth-panel .brand-block {
  margin-bottom: 24px;
}

.copyright {
  width: min(1120px, 100%);
  margin: 0 auto 24px;
  padding: 0 clamp(16px, 4vw, 40px);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  text-align: center;
}

.auth-shell .copyright {
  margin-top: 18px;
  padding: 0;
}

@media (max-width: 980px) {
  .product-row,
  .user-row,
  .pending-row {
    grid-template-columns: 1fr;
    align-items: stretch;
  }
}

@media (max-width: 760px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

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

@media (max-width: 900px) {
  .payments-table {
    border-collapse: separate;
    border-spacing: 0 12px;
  }

  .payments-table thead {
    display: none;
  }

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

  .payments-table tr {
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fbfdfb;
  }

  .payments-table td {
    display: grid;
    grid-template-columns: minmax(92px, 0.36fr) minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    padding: 8px 0;
    border-bottom: 1px solid #e7eeea;
  }

  .payments-table td:last-child {
    border-bottom: 0;
  }

  .payments-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 900;
    text-transform: uppercase;
  }
}
