:root {
  color-scheme: light;
  --ink: #151617;
  --muted: #686d6f;
  --paper: #fbfbfa;
  --card: #ffffff;
  --band: #f0f2f3;
  --line: #d7dbdc;
  --green: #315f53;
  --green-dark: #244a41;
  --green-soft: #dceae5;
  --red: #8d4338;
  --red-soft: #f4e4e0;
  --amber: #76550e;
  --amber-soft: #f3ead0;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  overflow-x: hidden;
  background: var(--paper);
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background: var(--paper);
  font-family: "Avenir Next", "Century Gothic", "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

::selection {
  color: #fff;
  background: var(--green);
}

button,
input {
  font: inherit;
}

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

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 3px;
}

.hidden {
  display: none !important;
}

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

.topbar,
main {
  width: min(1120px, calc(100% - 48px));
  margin-right: auto;
  margin-left: auto;
}

.topbar {
  min-height: 84px;
  padding: 20px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  text-decoration: none;
}

.brand-dot {
  width: 38px;
  height: 38px;
  border: 1px solid var(--ink);
}

.brand-dot::after {
  width: 8px;
  height: 8px;
  display: block;
  margin: 14px;
  background: var(--ink);
  content: "";
}

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

.brand strong {
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .18em;
  text-transform: uppercase;
}

.brand small {
  margin-top: 3px;
  color: var(--muted);
  font-size: .68rem;
  letter-spacing: .17em;
  text-transform: uppercase;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 22px;
}

.top-actions a,
.link-button {
  min-height: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  border: 0;
  color: var(--ink);
  background: transparent;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-decoration: none;
  text-transform: uppercase;
  cursor: pointer;
}

.top-actions a:hover,
.link-button:hover {
  color: var(--green);
}

.account-label {
  max-width: 15rem;
  overflow: hidden;
  color: var(--muted);
  font-size: .72rem;
  letter-spacing: .08em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

main {
  padding: 112px 0 120px;
}

.state-card {
  position: relative;
  z-index: 0;
  isolation: isolate;
  min-height: 330px;
  padding: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  text-align: center;
}

.state-card::before {
  position: absolute;
  z-index: -1;
  inset: -50px calc(50% - 50vw);
  background: var(--band);
  clip-path: polygon(0 4%, 100% 0, 100% 96%, 0 100%);
  content: "";
}

.state-card h1 {
  margin: 14px 0 15px;
  font-size: clamp(2.35rem, 6vw, 4.2rem);
  font-weight: 650;
  letter-spacing: -.045em;
}

.state-card p {
  margin: 0 0 24px;
  color: var(--muted);
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1.65;
}

.spinner {
  width: 28px;
  height: 28px;
  border: 2px solid var(--line);
  border-top-color: var(--ink);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

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

.dashboard {
  position: relative;
}

.intro-row {
  position: relative;
  min-height: 190px;
  margin-bottom: 68px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  text-align: center;
}

.intro-row > div::after {
  width: 44px;
  height: 2px;
  margin: 27px auto 0;
  display: block;
  background: var(--ink);
  content: "";
}

.intro-row h1 {
  margin: 22px 0 17px;
  font-size: clamp(2.9rem, 6.6vw, 5.4rem);
  font-weight: 650;
  letter-spacing: -.055em;
  line-height: .98;
}

.intro-row p {
  margin: 0;
  color: var(--muted);
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1.7;
}

.intro-row > .secondary-button {
  position: absolute;
  top: 0;
  right: 0;
}

.label {
  color: var(--ink);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .25em;
  text-transform: uppercase;
}

.stats {
  position: relative;
  z-index: 0;
  margin: 0 0 82px;
  padding: 54px 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
}

.stats::before {
  position: absolute;
  z-index: -1;
  inset: 0 calc(50% - 50vw);
  background: var(--band);
  clip-path: polygon(0 7%, 100% 0, 100% 93%, 0 100%);
  content: "";
}

.stats article {
  padding: 20px 28px;
  border-right: 1px solid var(--line);
  text-align: center;
}

.stats article:last-child {
  border-right: 0;
}

.stats span {
  display: block;
  color: var(--muted);
  font-size: .72rem;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.stats strong {
  margin-top: 10px;
  display: block;
  font-size: 2.6rem;
  font-weight: 600;
}

.panel {
  margin-top: 22px;
  padding: 34px;
  border: 1px solid var(--line);
  background: var(--card);
}

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

.panel-title h2 {
  margin: 10px 0 0;
  font-size: 1.45rem;
  font-weight: 650;
  letter-spacing: -.02em;
}

.panel-copy {
  margin: -9px 0 20px;
  color: var(--muted);
  font-family: Georgia, "Times New Roman", serif;
  font-size: .9rem;
  line-height: 1.6;
}

.primary-button,
.secondary-button,
.action-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 1px;
  font-size: .7rem;
  font-weight: 800;
  letter-spacing: .07em;
  text-decoration: none;
  text-transform: uppercase;
  cursor: pointer;
}

.primary-button {
  min-height: 46px;
  padding: 0 17px;
  border: 1px solid var(--ink);
  color: #fff;
  background: var(--ink);
}

.primary-button:hover {
  border-color: var(--green-dark);
  background: var(--green-dark);
}

.secondary-button {
  min-height: 44px;
  padding: 0 15px;
  border: 1px solid var(--ink);
  color: var(--ink);
  background: transparent;
}

.secondary-button:hover {
  color: #fff;
  background: var(--ink);
}

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

.add-form label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: .75rem;
  font-weight: 700;
}

.add-form > div {
  display: flex;
  gap: 10px;
}

input {
  min-width: 0;
  min-height: 44px;
  border: 1px solid var(--line);
  color: var(--ink);
  background: #fff;
}

input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(49, 95, 83, .11);
}

.add-form input {
  width: min(100%, 430px);
  padding: 0 13px;
}

.search-field input {
  width: 220px;
  padding: 0 13px;
}

.soft-badge,
.role-badge,
.status-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 0;
  font-size: .7rem;
  font-weight: 800;
  letter-spacing: .03em;
}

.soft-badge {
  padding: 7px 10px;
  border: 1px solid #d9c998;
  color: var(--amber);
  background: var(--amber-soft);
}

.role-badge,
.status-badge {
  padding: 5px 8px;
}

.role-badge.admin,
.status-badge.active {
  border: 1px solid #b6cdc5;
  color: var(--green-dark);
  background: var(--green-soft);
}

.role-badge.user {
  border: 1px solid var(--line);
  color: var(--muted);
  background: #eff2ef;
}

.status-badge.pending {
  border: 1px solid #d9c998;
  color: var(--amber);
  background: var(--amber-soft);
}

.status-badge.denied,
.status-badge.disabled {
  border: 1px solid #dfbbb2;
  color: var(--red);
  background: var(--red-soft);
}

.list {
  border-top: 1px solid var(--line);
}

.empty {
  padding: 25px 4px 7px;
  color: var(--muted);
  font-size: .88rem;
}

.list-row {
  padding: 20px 2px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  border-bottom: 1px solid var(--line);
}

.list-row:last-child {
  border-bottom: 0;
}

.identity {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.identity img,
.avatar-placeholder {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
}

.identity img {
  object-fit: cover;
}

.avatar-placeholder {
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--ink);
  font-weight: 800;
}

.identity strong,
.identity small {
  display: block;
}

.identity strong {
  overflow: hidden;
  text-overflow: ellipsis;
}

.identity small {
  margin-top: 3px;
  color: var(--muted);
  font-size: .76rem;
}

.badges {
  margin-top: 7px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.action-button {
  min-height: 36px;
  padding: 0 11px;
  border: 1px solid var(--line);
  color: var(--ink);
  background: transparent;
}

.action-button.good {
  border-color: #adc6bd;
  color: var(--green);
  background: var(--green-soft);
}

.action-button.danger {
  border-color: #dfbbb2;
  color: var(--red);
  background: var(--red-soft);
}

.quota-control {
  display: flex;
  align-items: center;
  gap: 6px;
}

.quota-control input {
  width: 82px;
  min-height: 36px;
  padding: 0 9px;
}

.quota-caption {
  color: var(--muted);
  font-size: .7rem;
  white-space: nowrap;
}

.toast-region {
  position: fixed;
  z-index: 20;
  right: 18px;
  bottom: 18px;
  display: grid;
  gap: 9px;
}

.toast {
  max-width: 360px;
  padding: 13px 15px;
  color: #fff;
  background: var(--ink);
  box-shadow: 0 12px 34px rgba(0, 0, 0, .16);
  font-size: .84rem;
}

.toast.error {
  background: #79392f;
}

@media (max-width: 820px) {
  .intro-row {
    align-items: center;
    flex-direction: column;
  }

  .intro-row > .secondary-button {
    position: static;
    margin-top: 25px;
  }

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

  .row-actions {
    width: 100%;
    justify-content: flex-start;
  }
}

@media (max-width: 640px) {
  .topbar,
  main {
    width: min(100% - 28px, 1120px);
  }

  .topbar {
    min-height: 72px;
    padding: 14px 0;
    align-items: flex-start;
  }

  .brand-dot {
    width: 34px;
    height: 34px;
  }

  .brand-dot::after {
    margin: 12px;
  }

  .brand strong {
    font-size: .69rem;
  }

  .brand small {
    font-size: .65rem;
  }

  .top-actions {
    align-items: flex-end;
    flex-direction: column;
    gap: 0;
  }

  .top-actions a,
  .link-button {
    min-height: 40px;
  }

  .account-label {
    max-width: 11rem;
  }

  main {
    padding: 78px 0 86px;
  }

  .state-card {
    padding: 34px 20px;
  }

  .state-card::before {
    clip-path: polygon(0 1.4%, 100% 0, 100% 98.6%, 0 100%);
  }

  .intro-row {
    min-height: 0;
    margin-bottom: 58px;
  }

  .intro-row h1 {
    font-size: clamp(2.7rem, 14vw, 4.5rem);
  }

  .stats {
    margin-bottom: 65px;
    padding: 32px 0;
    grid-template-columns: 1fr;
  }

  .stats::before {
    clip-path: polygon(0 2%, 100% 0, 100% 98%, 0 100%);
  }

  .stats article {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .stats article:last-child {
    border-bottom: 0;
  }

  .panel,
  .state-card {
    padding: 24px;
  }

  .panel-title.user-title {
    align-items: flex-start;
    flex-direction: column;
  }

  .add-form > div {
    flex-direction: column;
  }

  .add-form input,
  .add-form button,
  .search-field,
  .search-field input {
    width: 100%;
  }

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

  .action-button {
    min-height: 44px;
  }

  .quota-control {
    width: 100%;
  }

  .quota-control input {
    flex: 1;
    min-height: 44px;
  }
}

@media (max-width: 420px) {
  .topbar {
    gap: 12px;
  }

  .brand small {
    display: none;
  }

  .top-actions {
    max-width: 8rem;
  }

  .account-label {
    max-width: 7.5rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }

  .spinner {
    animation: none;
  }
}
