:root {
  color-scheme: light;
  --auth-navy: #15192f;
  --auth-navy-soft: #202642;
  --auth-ink: #171b2f;
  --auth-muted: #6f778a;
  --auth-canvas: #f1f3f7;
  --auth-surface: #fff;
  --auth-line: #e3e7ef;
  --auth-blue: #4f7df3;
  --auth-blue-dark: #365fc4;
  --auth-blue-soft: #edf3ff;
  --auth-green: #07956d;
  --auth-green-soft: #e4fbf3;
  --auth-red: #c7434e;
  --auth-red-soft: #fff0f1;
  --auth-shadow: 0 18px 50px rgba(25, 31, 55, 0.13);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--auth-canvas);
}

.auth-page {
  min-height: 100vh;
  margin: 0;
  color: var(--auth-ink);
  background: var(--auth-canvas);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

.auth-page button,
.auth-page input,
.auth-page select {
  font: inherit;
}

.auth-page button,
.auth-page summary {
  cursor: pointer;
}

.auth-page [hidden] {
  display: none !important;
}

.auth-view {
  min-height: 100vh;
}

.auth-loading-view {
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 15px;
  color: var(--auth-muted);
  font-size: 13px;
}

.auth-loading-mark {
  width: 34px;
  height: 34px;
  border: 3px solid #dbe0e9;
  border-top-color: var(--auth-blue);
  border-radius: 50%;
  animation: auth-spin 800ms linear infinite;
}

.auth-gate {
  position: relative;
  display: grid;
  overflow: hidden;
  padding: 38px 20px;
  place-items: center;
  background:
    radial-gradient(circle at 8% 0%, rgba(79, 125, 243, 0.18), transparent 30%),
    linear-gradient(135deg, #101429 0%, #1a203e 58%, #11162e 100%);
}

.auth-ambient {
  position: absolute;
  width: 540px;
  height: 540px;
  top: -260px;
  right: -180px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 50%;
  box-shadow:
    0 0 0 74px rgba(79, 125, 243, 0.035),
    0 0 0 148px rgba(79, 125, 243, 0.025);
  pointer-events: none;
}

.auth-card {
  position: relative;
  z-index: 1;
  width: min(440px, 100%);
  padding: 38px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.985);
  box-shadow: var(--auth-shadow);
}

.auth-password-card {
  width: min(490px, 100%);
}

.auth-brand {
  display: inline-flex;
  align-items: center;
  color: inherit;
  font-size: 13px;
  font-weight: 620;
  text-decoration: none;
}

.auth-brand-name {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.035em;
}

.auth-brand-divider {
  width: 1px;
  height: 20px;
  margin: 0 12px;
  background: currentColor;
  opacity: 0.18;
}

.auth-eyebrow {
  margin: 34px 0 7px;
  color: var(--auth-blue-dark);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.auth-card h1,
.auth-welcome h1 {
  margin: 0;
  font-size: clamp(27px, 5vw, 34px);
  letter-spacing: -0.035em;
}

.auth-intro,
.auth-welcome p,
.auth-section-heading p {
  color: var(--auth-muted);
  font-size: 13px;
  line-height: 1.6;
}

.auth-intro {
  margin: 9px 0 27px;
}

.auth-form {
  display: grid;
  gap: 9px;
}

.auth-form label,
.auth-create-form label {
  margin-top: 8px;
  color: #3c4356;
  font-size: 11px;
  font-weight: 720;
}

.auth-page input,
.auth-page select {
  width: 100%;
  min-height: 43px;
  padding: 0 12px;
  border: 1px solid #d6dbe5;
  border-radius: 8px;
  color: var(--auth-ink);
  background: #fff;
  outline: none;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.auth-page input:focus,
.auth-page select:focus {
  border-color: var(--auth-blue);
  box-shadow: 0 0 0 3px rgba(79, 125, 243, 0.14);
}

.auth-password-field {
  position: relative;
}

.auth-password-field input {
  padding-right: 58px;
}

.auth-password-toggle {
  position: absolute;
  top: 50%;
  right: 5px;
  min-width: 48px;
  padding: 7px;
  transform: translateY(-50%);
  border: 0;
  border-radius: 6px;
  color: var(--auth-blue-dark);
  background: transparent;
  font-size: 11px;
  font-weight: 720;
}

.auth-password-toggle:hover {
  background: var(--auth-blue-soft);
}

.auth-primary-button,
.auth-secondary-button,
.auth-text-button {
  display: inline-flex;
  min-height: 40px;
  padding: 0 15px;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 750;
  text-decoration: none;
}

.auth-primary-button {
  border: 1px solid var(--auth-blue);
  color: #fff;
  background: var(--auth-blue);
  box-shadow: 0 7px 16px rgba(79, 125, 243, 0.2);
}

.auth-primary-button:hover:not(:disabled) {
  border-color: var(--auth-blue-dark);
  background: var(--auth-blue-dark);
}

.auth-secondary-button {
  border: 1px solid #d8dde7;
  color: #3b4357;
  background: #fff;
}

.auth-secondary-button:hover:not(:disabled) {
  border-color: #bcc4d4;
  background: #f8f9fb;
}

.auth-text-button {
  min-height: 34px;
  padding: 0 6px;
  border: 0;
  color: var(--auth-blue-dark);
  background: transparent;
}

.auth-submit {
  justify-content: space-between;
  margin-top: 14px;
}

.auth-page button:disabled {
  cursor: wait;
  opacity: 0.58;
}

.auth-page button:focus-visible,
.auth-page a:focus-visible,
.auth-page summary:focus-visible,
.auth-page code:focus-visible,
.auth-page h1:focus-visible {
  outline: 3px solid rgba(79, 125, 243, 0.35);
  outline-offset: 3px;
}

.auth-error {
  margin: 8px 0 0;
  padding: 10px 12px;
  border: 1px solid #efc7cb;
  border-radius: 8px;
  color: #9b3039;
  background: var(--auth-red-soft);
  font-size: 11px;
  line-height: 1.45;
}

.auth-hint,
.auth-footnote {
  color: var(--auth-muted);
  font-size: 10px;
  line-height: 1.55;
}

.auth-hint {
  margin: 0 0 3px;
}

.auth-footnote {
  margin: 24px 0 0;
  padding-top: 18px;
  border-top: 1px solid var(--auth-line);
}

.auth-card-actions {
  display: flex;
  gap: 13px;
  margin-top: 17px;
  justify-content: center;
}

.auth-app {
  min-height: 100vh;
  background:
    radial-gradient(circle at 8% 0%, rgba(79, 125, 243, 0.055), transparent 27%),
    var(--auth-canvas);
}

.auth-app-header {
  position: sticky;
  z-index: 10;
  top: 0;
  color: #fff;
  background:
    radial-gradient(circle at 82% -80%, rgba(79, 125, 243, 0.35), transparent 35%),
    linear-gradient(115deg, #12152a 0%, #181d37 60%, #12162b 100%);
  box-shadow: 0 8px 24px rgba(13, 16, 36, 0.16);
}

.auth-header-inner {
  display: flex;
  width: min(1180px, 100%);
  min-height: 66px;
  margin: 0 auto;
  padding: 0 28px;
  align-items: center;
  justify-content: space-between;
}

.auth-user-menu {
  position: relative;
}

.auth-user-menu summary {
  display: flex;
  gap: 9px;
  min-height: 46px;
  padding: 6px 9px;
  align-items: center;
  border: 1px solid transparent;
  border-radius: 9px;
  list-style: none;
}

.auth-user-menu summary::-webkit-details-marker {
  display: none;
}

.auth-user-menu summary:hover,
.auth-user-menu[open] summary {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.08);
}

.auth-user-avatar {
  display: grid;
  width: 31px;
  height: 31px;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  background: var(--auth-blue);
  font-size: 12px;
  font-weight: 800;
}

.auth-user-summary {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.auth-user-summary strong {
  overflow: hidden;
  max-width: 220px;
  font-size: 11px;
  text-overflow: ellipsis;
}

.auth-user-summary small {
  color: rgba(255, 255, 255, 0.57);
  font-size: 9px;
}

.auth-chevron {
  color: rgba(255, 255, 255, 0.64);
  transition: transform 140ms ease;
}

.auth-user-menu[open] .auth-chevron {
  transform: rotate(180deg);
}

.auth-user-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  display: grid;
  width: 245px;
  padding: 9px;
  border: 1px solid var(--auth-line);
  border-radius: 11px;
  color: var(--auth-ink);
  background: #fff;
  box-shadow: var(--auth-shadow);
}

.auth-user-popover p {
  overflow: hidden;
  margin: 3px 7px 9px;
  color: var(--auth-muted);
  font-size: 10px;
  text-overflow: ellipsis;
}

.auth-user-popover a,
.auth-user-popover button {
  width: 100%;
  min-height: 37px;
  padding: 0 9px;
  border: 0;
  border-radius: 7px;
  color: #343b50;
  background: transparent;
  font-size: 11px;
  font-weight: 650;
  line-height: 37px;
  text-align: left;
  text-decoration: none;
}

.auth-user-popover a:hover,
.auth-user-popover button:hover {
  background: #f3f5f8;
}

.auth-user-popover .auth-menu-danger {
  color: var(--auth-red);
}

.auth-content {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 34px 28px 60px;
}

.auth-welcome,
.auth-users-panel {
  border: 1px solid var(--auth-line);
  border-radius: 13px;
  background: var(--auth-surface);
  box-shadow: 0 8px 26px rgba(29, 35, 58, 0.055);
}

.auth-welcome {
  display: flex;
  padding: 27px 30px;
  align-items: center;
  justify-content: space-between;
}

.auth-welcome .auth-eyebrow,
.auth-section-heading .auth-eyebrow,
.auth-password-dialog .auth-eyebrow {
  margin-top: 0;
}

.auth-welcome p {
  margin-bottom: 0;
}

.auth-users-panel {
  margin-top: 25px;
  padding: 30px;
  scroll-margin-top: 86px;
}

.auth-section-heading {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  justify-content: space-between;
}

.auth-section-heading h2 {
  margin: 0;
  font-size: 24px;
  letter-spacing: -0.025em;
}

.auth-section-heading p {
  margin: 7px 0 0;
}

.auth-create-user {
  margin: 24px 0;
  padding: 20px;
  border: 1px solid #dbe4f6;
  border-radius: 10px;
  background: #f8faff;
}

.auth-create-user h3 {
  margin: 0 0 15px;
  font-size: 14px;
}

.auth-create-form {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(140px, 0.4fr) auto;
  gap: 12px;
  align-items: end;
}

.auth-create-field {
  display: grid;
  gap: 6px;
  margin: 0 !important;
}

.auth-create-form .auth-primary-button {
  min-height: 43px;
}

.auth-create-user .auth-hint {
  margin: 10px 0 0;
}

.auth-list-status {
  margin: 25px 0;
  color: var(--auth-muted);
  font-size: 12px;
  text-align: center;
}

.auth-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--auth-line);
  border-radius: 10px;
}

.auth-users-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.auth-users-table th,
.auth-users-table td {
  padding: 13px 12px;
  border-bottom: 1px solid var(--auth-line);
  text-align: left;
  vertical-align: middle;
}

.auth-users-table th {
  color: var(--auth-muted);
  background: #f8f9fb;
  font-size: 9px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.auth-users-table tr:last-child td {
  border-bottom: 0;
}

.auth-user-email {
  display: block;
  max-width: 280px;
  overflow: hidden;
  font-weight: 700;
  text-overflow: ellipsis;
}

.auth-current-user {
  display: inline-block;
  margin-top: 4px;
  color: var(--auth-blue-dark);
  font-size: 9px;
  font-weight: 750;
}

.auth-users-table select {
  min-width: 125px;
  min-height: 35px;
  font-size: 10px;
}

.auth-status {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  color: var(--auth-green);
  font-weight: 700;
}

.auth-status::before {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

.auth-status-inactive {
  color: var(--auth-muted);
}

.auth-row-actions {
  display: flex;
  gap: 7px;
  justify-content: flex-end;
}

.auth-row-button {
  min-height: 31px;
  padding: 0 9px;
  border: 1px solid #d8dde7;
  border-radius: 6px;
  color: #4b5366;
  background: #fff;
  font-size: 9px;
  font-weight: 720;
  white-space: nowrap;
}

.auth-row-button:hover:not(:disabled) {
  border-color: #bbc3d3;
  background: #f7f8fa;
}

.auth-row-danger {
  color: var(--auth-red);
}

.auth-empty-row {
  padding: 28px !important;
  color: var(--auth-muted);
  text-align: center !important;
}

.auth-password-dialog {
  width: min(520px, calc(100% - 32px));
  padding: 30px;
  border: 0;
  border-radius: 15px;
  color: var(--auth-ink);
  box-shadow: var(--auth-shadow);
}

.auth-password-dialog::backdrop {
  background: rgba(14, 18, 36, 0.65);
  backdrop-filter: blur(3px);
}

.auth-dialog-mark {
  display: grid;
  width: 38px;
  height: 38px;
  margin-bottom: 20px;
  place-items: center;
  border-radius: 10px;
  color: var(--auth-green);
  background: var(--auth-green-soft);
  font-weight: 850;
}

.auth-password-dialog h2 {
  margin: 0;
  font-size: 23px;
  letter-spacing: -0.025em;
}

.auth-password-dialog > p:not(.auth-eyebrow, .auth-copy-status) {
  color: var(--auth-muted);
  font-size: 12px;
  line-height: 1.55;
}

.auth-password-dialog code {
  display: block;
  overflow-wrap: anywhere;
  margin: 19px 0 8px;
  padding: 17px;
  border: 1px solid #cbd8f0;
  border-radius: 9px;
  color: #253762;
  background: var(--auth-blue-soft);
  font: 750 16px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace;
  letter-spacing: 0.025em;
  text-align: center;
}

.auth-copy-status {
  min-height: 17px;
  margin: 5px 0;
  color: var(--auth-green);
  font-size: 10px;
  font-weight: 700;
}

.auth-dialog-actions {
  display: flex;
  gap: 10px;
  margin-top: 17px;
  justify-content: flex-end;
}

.auth-dialog-actions form {
  margin: 0;
}

.auth-toast {
  position: fixed;
  z-index: 30;
  right: 22px;
  bottom: 22px;
  max-width: min(360px, calc(100% - 44px));
  padding: 12px 15px;
  border-radius: 9px;
  color: #fff;
  background: var(--auth-navy-soft);
  box-shadow: var(--auth-shadow);
  font-size: 11px;
  font-weight: 650;
}

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

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

@media (max-width: 760px) {
  .auth-header-inner,
  .auth-content {
    padding-right: 18px;
    padding-left: 18px;
  }

  .auth-user-summary {
    display: none;
  }

  .auth-welcome,
  .auth-section-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .auth-create-form {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .auth-users-panel {
    padding: 21px 16px;
  }

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

  .auth-dialog-actions form,
  .auth-dialog-actions button {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .auth-card {
    padding: 29px 23px;
  }

  .auth-gate {
    padding: 18px 13px;
  }

  .auth-brand {
    font-size: 11px;
  }

  .auth-user-popover {
    position: fixed;
    top: 70px;
    right: 12px;
    left: 12px;
    width: auto;
  }
}

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