:root {
  --auth-ink: #1b2824;
  --auth-muted: #65716c;
  --auth-line: #d8e0d9;
  --auth-field: #f7f9f6;
  --auth-paper: #fcfdfb;
  --auth-forest: #1d3a32;
  --auth-accent: #c78f45;
  --auth-danger: #a63f36;
}

* { box-sizing: border-box; }

body.auth-page,
body.members-page {
  min-width: 320px;
  margin: 0;
  color: var(--auth-ink);
  background: var(--auth-paper);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "PingFang SC", "Helvetica Neue", "Microsoft YaHei UI", "Microsoft YaHei", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.auth-shell {
  display: grid;
  grid-template-columns: minmax(560px, 1.08fr) minmax(440px, 0.92fr);
  min-height: 100vh;
}

.auth-brand {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  color: #f7faf6;
  background: #17261f;
}

.auth-brand-atlas {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.auth-brand::after {
  position: absolute;
  inset: 0;
  z-index: 0;
  content: "";
  pointer-events: none;
  background: rgba(10, 22, 16, 0.16);
}

.auth-brand-content {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  min-height: 100vh;
  padding: 68px clamp(42px, 6vw, 112px) 46px;
}

.auth-brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 24px;
}

.members-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.auth-brand-emblem {
  display: grid;
  width: 104px;
  height: 104px;
  place-items: center;
  border: 1px solid rgba(201, 157, 78, 0.88);
  background: #f2eee4;
  box-shadow: 8px 8px 0 rgba(22, 38, 30, 0.52);
}

.auth-brand-mark {
  width: 82px;
  height: 82px;
  object-fit: contain;
}

.members-brand > img:first-child {
  width: 38px;
  height: 38px;
  object-fit: contain;
}

.auth-brand-type {
  display: grid;
  gap: 10px;
}

.auth-brand-wordmark {
  width: 324px;
  max-width: min(45vw, 324px);
  height: auto;
  object-fit: contain;
}

.auth-brand-edition {
  color: #d0b171;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}

.members-brand > img:last-child {
  width: 150px;
  height: auto;
  object-fit: contain;
}

.auth-kicker {
  margin: 0 0 14px;
  color: #d5b46e;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.auth-brand-message {
  align-self: center;
  max-width: 560px;
  padding: 64px 0 42px;
}

.auth-brand h1 {
  max-width: 560px;
  margin: 0;
  color: #fbf7ed;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", "Helvetica Neue", "Microsoft YaHei UI", "Microsoft YaHei", Arial, sans-serif;
  font-size: 46px;
  font-weight: 600;
  line-height: 1.22;
}

.auth-brand-copy {
  max-width: 500px;
  margin: 22px 0 0;
  color: #d7ddd5;
  font-size: 15px;
  line-height: 1.8;
}

.auth-capabilities {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  width: min(100%, 590px);
  border-top: 1px solid rgba(210, 180, 109, 0.7);
  border-bottom: 1px solid rgba(210, 180, 109, 0.42);
}

.auth-capability {
  display: grid;
  gap: 6px;
  min-width: 0;
  padding: 15px 16px 15px 0;
}

.auth-capability + .auth-capability {
  padding-left: 16px;
  border-left: 1px solid rgba(210, 180, 109, 0.42);
}

.auth-capability > span {
  color: #d5b46e;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Helvetica Neue", "Microsoft YaHei UI", "Microsoft YaHei", Arial, sans-serif;
  font-size: 14px;
}

.auth-capability > strong {
  color: #f8f3e8;
  font-size: 15px;
  font-weight: 700;
}

.auth-capability > small {
  color: #b9c6bb;
  font-size: 12px;
  line-height: 1.45;
}

.auth-brand-foot {
  margin-top: 24px;
  color: #b6c1b7;
  font-size: 11px;
  font-weight: 700;
}

.auth-form-area {
  align-self: center;
  width: min(100%, 450px);
  margin: 0 auto;
  padding: 48px 42px;
}

.auth-form-head .auth-kicker,
.members-intro .auth-kicker {
  margin: 0 0 10px;
}

.auth-form-head h2,
.members-intro h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 650;
  line-height: 1.3;
}

.auth-form-head > p:last-child,
.members-intro > p {
  margin: 10px 0 0;
  color: var(--auth-muted);
  font-size: 14px;
  line-height: 1.65;
}

.auth-notice {
  margin: 24px 0 0;
  padding: 11px 13px;
  border: 1px solid var(--auth-line);
  color: #496056;
  background: #f2f7f2;
  font-size: 13px;
  line-height: 1.55;
}

.auth-notice.error {
  border-color: #e6c4bd;
  color: #81362e;
  background: #fff5f2;
}

.auth-form {
  display: grid;
  gap: 9px;
  margin-top: 30px;
}

.auth-form label {
  margin-top: 8px;
  color: #3c4b45;
  font-size: 13px;
  font-weight: 700;
}

.auth-form input {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--auth-line);
  border-radius: 3px;
  outline: none;
  color: var(--auth-ink);
  background: var(--auth-field);
  font: inherit;
}

.auth-form input:focus {
  border-color: var(--auth-forest);
  box-shadow: 0 0 0 3px rgba(29, 58, 50, 0.12);
}

.auth-form #code {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 8px;
  text-align: center;
}

.auth-submit,
.member-action {
  min-height: 44px;
  margin-top: 16px;
  padding: 10px 16px;
  border: 1px solid var(--auth-forest);
  border-radius: 3px;
  color: #fff;
  background: var(--auth-forest);
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
}

.auth-submit:hover,
.member-action:hover { background: #285044; }

.auth-resend {
  margin-top: 14px;
  text-align: center;
}

.auth-resend button,
.auth-switch a,
.members-topbar a,
.members-topbar button {
  border: 0;
  color: var(--auth-forest);
  background: transparent;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.auth-switch { margin: 22px 0 0; color: var(--auth-muted); font-size: 13px; text-align: center; }
.auth-switch a { margin-left: 4px; text-decoration: underline; text-underline-offset: 3px; }

.members-shell { width: min(1240px, calc(100% - 64px)); margin: 0 auto; padding: 28px 0 70px; }

.members-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 54px;
  border-bottom: 1px solid var(--auth-line);
}

.members-brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.members-brand > img:first-child { width: 32px; height: 32px; }
.members-brand > img:last-child {
  width: 128px;
  filter: invert(13%) sepia(17%) saturate(1050%) hue-rotate(103deg) brightness(90%) contrast(92%);
}
.members-topbar-actions { display: flex; align-items: center; gap: 18px; }
.members-topbar-actions form { margin: 0; }

.members-intro {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 32px;
  padding: 52px 0 28px;
}

.members-intro > p { width: min(440px, 100%); margin: 0; }

.members-table-wrap { overflow-x: auto; border-top: 1px solid var(--auth-line); }

.members-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.members-table th,
.members-table td { padding: 17px 13px; border-bottom: 1px solid var(--auth-line); text-align: left; white-space: nowrap; }
.members-table th { color: var(--auth-muted); font-size: 12px; font-weight: 700; }
.members-table td:first-child { font-weight: 700; }
.members-table form { margin: 0; }

.member-status { display: inline-block; padding: 4px 7px; border: 1px solid var(--auth-line); font-size: 12px; font-weight: 700; }
.member-status.active { color: #2d6a50; background: #eff8f1; border-color: #cce4d2; }
.member-status.pending { color: #966326; background: #fff7e8; border-color: #ead8ad; }
.member-status.disabled { color: #94443b; background: #fff1ef; border-color: #ebc9c3; }
.member-self { color: var(--auth-muted); font-size: 12px; }
.member-action { min-height: 32px; margin: 0; padding: 5px 10px; font-size: 12px; }
.member-action.danger { border-color: var(--auth-danger); background: var(--auth-danger); }
.member-action.danger:hover { background: #8c352d; }

.membership-admin-shell { padding-bottom: 96px; }
.admin-section { margin-top: 46px; border-top: 1px solid var(--auth-line); }
.admin-section-head { display: flex; align-items: end; justify-content: space-between; gap: 24px; padding: 22px 0 16px; }
.admin-section-head .auth-kicker { margin-bottom: 5px; }
.admin-section-head h2 { margin: 0; color: var(--auth-ink); font-size: 21px; line-height: 1.2; }
.admin-section-head > span { color: var(--auth-muted); font-size: 12px; }
.member-overview-table td { vertical-align: middle; }
.member-overview-table td small { display: block; margin-top: 5px; color: var(--auth-muted); font-size: 11px; font-weight: 500; }
.member-row-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.member-action.plain { border-color: var(--auth-line); color: var(--auth-forest); background: transparent; }
.member-action.plain:hover { background: #eff5f1; }
.member-grant-row td { padding: 10px 13px 15px; background: rgba(239, 245, 241, .42); }
.member-inline-form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.member-inline-form label { color: var(--auth-muted); font-size: 12px; font-weight: 700; }
.member-inline-form select,
.member-inline-form input,
.plan-editor input:not([type="checkbox"]),
.plan-editor select,
.code-batch-form input,
.code-batch-form select { min-height: 34px; padding: 6px 8px; border: 1px solid var(--auth-line); border-radius: 3px; color: var(--auth-ink); background: var(--auth-field); font: inherit; font-size: 12px; }
.member-inline-form input { width: 82px; }
.plan-editor-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 1px solid var(--auth-line); border-left: 1px solid var(--auth-line); }
.plan-editor { display: grid; gap: 13px; min-width: 0; padding: 18px; border-right: 1px solid var(--auth-line); border-bottom: 1px solid var(--auth-line); }
.plan-editor-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.plan-editor-head strong { color: var(--auth-forest); font-size: 13px; text-transform: uppercase; letter-spacing: .06em; }
.plan-editor label { display: grid; gap: 6px; color: var(--auth-muted); font-size: 12px; font-weight: 700; }
.plan-editor-head label,
.plan-editor-checks label { display: inline-flex; align-items: center; gap: 6px; }
.plan-editor-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.plan-editor-checks { display: grid; gap: 8px; }
.plan-editor .member-action { justify-self: start; }
.code-batch-form { display: grid; grid-template-columns: 1.25fr .85fr .6fr .6fr 1fr auto; gap: 10px; align-items: end; padding: 18px 0; border-top: 1px solid var(--auth-line); }
.code-batch-form label { display: grid; gap: 6px; min-width: 0; color: var(--auth-muted); font-size: 12px; font-weight: 700; }
.code-batch-form .member-action { margin: 0; white-space: nowrap; }
.batch-table form { margin: 0; }
.member-empty { color: var(--auth-muted); text-align: center !important; }

@media (max-width: 1040px) and (min-width: 781px) {
  .auth-shell { grid-template-columns: minmax(470px, 1fr) minmax(390px, 0.82fr); }
  .auth-brand-content { padding-right: 44px; padding-left: 44px; }
  .auth-brand h1 { font-size: 39px; }
  .auth-brand-wordmark { width: 234px; }
  .auth-capability { padding-right: 12px; }
  .auth-capability + .auth-capability { padding-left: 12px; }
}

@media (max-width: 780px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-brand { min-height: 650px; }
  .auth-brand-atlas { object-position: 62% center; }
  .auth-brand-content { min-height: 650px; padding: 34px 28px 28px; }
  .auth-brand-lockup { gap: 14px; }
  .auth-brand-emblem { width: 68px; height: 68px; box-shadow: 5px 5px 0 rgba(22, 38, 30, 0.5); }
  .auth-brand-mark { width: 54px; height: 54px; }
  .auth-brand-wordmark { width: min(230px, 54vw); }
  .auth-brand-edition { font-size: 9px; }
  .auth-brand-message { padding: 44px 0 28px; }
  .auth-brand h1 { max-width: 410px; font-size: 30px; }
  .auth-brand-copy { max-width: 380px; margin-top: 15px; font-size: 13px; line-height: 1.7; }
  .auth-capabilities { width: 100%; }
  .auth-capability { gap: 4px; padding: 11px 8px 11px 0; }
  .auth-capability + .auth-capability { padding-left: 8px; }
  .auth-capability > span { font-size: 12px; }
  .auth-capability > strong { font-size: 13px; }
  .auth-capability > small { font-size: 10px; }
  .auth-brand-foot { margin-top: 16px; font-size: 9px; }
  .auth-kicker { margin: 0 0 10px; }
  .auth-form-area { padding: 42px 28px 52px; }
  .members-shell { width: min(100% - 32px, 1240px); padding-top: 18px; }
  .members-intro { display: block; padding: 38px 0 23px; }
  .members-intro > p { margin-top: 14px; }
  .admin-section { margin-top: 34px; }
  .admin-section-head { display: block; padding: 18px 0 14px; }
  .admin-section-head > span { display: block; margin-top: 8px; }
  .plan-editor-grid { grid-template-columns: 1fr; }
  .code-batch-form { grid-template-columns: 1fr 1fr; }
  .code-batch-form .member-action { grid-column: 1 / -1; width: 100%; }
}
