:root {
  --bg: #f6f8f5;
  --panel: #ffffff;
  --line: #dfe6df;
  --ink: #1f2a24;
  --muted: #607067;
  --brand: #236b4f;
  --brand-2: #e7f1eb;
  --danger: #b3261e;
  --warn: #9a6700;
  --info: #2457a6;
}

* {
  box-sizing: border-box;
}

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

button,
input,
select,
textarea {
  font: inherit;
}

button {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  padding: 0 16px;
  background: var(--brand);
  color: white;
  font-weight: 700;
  cursor: pointer;
}

button.secondary {
  background: white;
  color: var(--brand);
  border: 1px solid var(--line);
}

button.danger {
  background: var(--danger);
  color: white;
  border: 1px solid var(--danger);
}

button.small {
  min-height: 34px;
  padding: 0 10px;
  border-radius: 6px;
  font-size: 13px;
}

button.link,
button.consecutive-link,
a.consecutive-link {
  background: transparent;
  color: var(--brand);
}

button.consecutive-link,
a.consecutive-link {
  display: inline-flex;
  font-weight: 800;
  min-height: auto;
  padding: 0;
  border-radius: 0;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 3px;
}

a.consecutive-link:hover {
  color: #174b37;
}

button:disabled {
  opacity: .45;
  cursor: not-allowed;
}

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

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: white;
  color: var(--ink);
}

label {
  display: block;
  margin: 12px 0 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}

.helper {
  margin: 8px 0 0;
  padding: 10px 12px;
  border: 1px solid #f1d18a;
  border-radius: 8px;
  background: #fff8e7;
  color: #6f4a00;
  font-size: 13px;
  font-weight: 700;
}

.alerts {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.alerts .alert-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid #f1d18a;
  border-radius: 8px;
  background: #fff8e7;
  color: #6f4a00;
}

.alerts span {
  color: #7b5a17;
  font-size: 13px;
}

.alerts strong {
  display: block;
  margin-bottom: 3px;
  color: #6f4a00;
}

.app {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 24px;
  border-right: 1px solid var(--line);
  background: #fff;
  padding: 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: var(--brand);
  color: white;
  font-weight: 800;
}

nav {
  display: grid;
  gap: 8px;
}

.nav {
  justify-content: flex-start;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.nav.active {
  background: var(--brand-2);
  color: var(--brand);
}

.role-box {
  margin-top: auto;
}

.access-note {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.content {
  padding: 24px;
  overflow: auto;
}

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

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 28px;
}

h2 {
  font-size: 18px;
}

.hidden {
  display: none !important;
}

.login-card,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}

.login-card {
  max-width: 420px;
  margin: 10vh auto;
}

.filters {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) 240px repeat(5, auto);
  gap: 12px;
  margin-bottom: 14px;
}

.collections-filters {
  grid-template-columns: minmax(260px, 1fr) auto auto auto auto;
}

.users-filters {
  grid-template-columns: minmax(260px, 1fr) 260px;
}

.notification-filters {
  grid-template-columns: minmax(260px, 1fr) 220px auto;
}

.price-search {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 240px auto;
  gap: 12px;
  margin-top: 14px;
}

.table-wrap {
  overflow: auto;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.table-wrap.compact {
  margin-top: 14px;
}

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

th,
td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

th {
  background: #eef4ef;
  color: #2d4035;
  font-size: 13px;
}

td {
  font-size: 14px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 800;
}

.badge.info {
  background: #e7eefb;
  color: var(--info);
}

.badge.warn {
  background: #fff3d6;
  color: var(--warn);
}

.badge.ok {
  background: #e6f3ec;
  color: var(--brand);
}

.badge.danger {
  background: #fde8e5;
  color: var(--danger);
}

.grid.two {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

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

.collections-metrics.scoped,
.collection-groups.scoped,
.collection-groups.filtered {
  grid-template-columns: minmax(0, 1fr);
}

.collection-groups table {
  min-width: 760px;
}

.metric {
  display: grid;
  gap: 6px;
}

.metric span,
.metric small {
  color: var(--muted);
  font-weight: 700;
}

.metric strong {
  font-size: 26px;
}

.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.check {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
}

.check input {
  width: auto;
  min-height: auto;
}

.summary {
  margin-top: 12px;
  padding: 12px;
  border-radius: 8px;
  background: #f2f5f1;
  color: var(--muted);
}

.total-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 16px 0;
  font-size: 22px;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  max-width: 420px;
  padding: 14px 16px;
  border-radius: 8px;
  background: #1f2a24;
  color: white;
  box-shadow: 0 14px 30px rgba(0, 0, 0, .18);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 22px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(31, 42, 36, .42);
}

.modal-card {
  position: relative;
  width: min(1120px, 100%);
  max-height: min(760px, calc(100vh - 44px));
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: 0 22px 60px rgba(0, 0, 0, .24);
}

.confirm-card {
  position: relative;
  display: grid;
  gap: 14px;
  width: min(460px, 100%);
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: 0 22px 60px rgba(0, 0, 0, .24);
}

.confirm-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.payment-card {
  width: min(540px, 100%);
}

.payment-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 14px;
  padding: 12px;
  border-radius: 8px;
  background: #f2f5f1;
}

.payment-summary span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.payment-summary strong {
  font-size: 16px;
}

.modal-header {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
  background: white;
}

.detail-content {
  display: grid;
  gap: 16px;
  padding: 18px;
}

.detail-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.detail-summary span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.detail-summary strong {
  display: block;
  margin-top: 4px;
}

.detail-section-title {
  margin: 4px 0 -4px;
  font-size: 16px;
}

@media (max-width: 900px) {
  .app {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 2;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  nav {
    grid-template-columns: repeat(9, 1fr);
  }

  .filters,
  .users-filters,
  .notification-filters,
  .price-search,
  .grid.two,
  .grid.three {
    grid-template-columns: 1fr;
  }

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

  .detail-summary {
    grid-template-columns: 1fr;
  }
}
