* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 8%, rgba(51, 126, 169, 0.08), transparent 34rem),
    var(--bg);
  font-family: var(--font-sans);
}

button,
input,
select {
  font: inherit;
}

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

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

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

.auth-card {
  width: min(100%, 430px);
  padding: 38px;
  border: 1px solid rgba(229, 231, 235, 0.9);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 24px 70px rgba(17, 24, 39, 0.09);
}

.auth-brand {
  display: inline-flex;
  align-items: center;
  color: var(--ink);
  font-size: 17px;
  font-weight: 650;
  gap: 10px;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.auth-brand img {
  width: 34px;
  height: 34px;
  border-radius: 9px;
}

.auth-brand.compact img {
  width: 30px;
  height: 30px;
}

.auth-heading {
  margin: 42px 0 28px;
}

.auth-heading h1,
.account-intro h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 38px;
  font-weight: 300;
  letter-spacing: -0.04em;
}

.auth-heading > p:last-child,
.account-intro > p:last-child,
.account-panel > div > p,
.panel-heading p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.auth-eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

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

.auth-form label,
.create-user-form label {
  display: grid;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 650;
  gap: 8px;
}

.auth-form input,
.create-user-form input,
.create-user-form select,
.user-row select {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 9px;
  color: var(--ink);
  background: var(--card);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.auth-form input:focus,
.create-user-form input:focus,
.create-user-form select:focus,
.user-row select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(51, 126, 169, 0.12);
  outline: 0;
}

.auth-primary,
.auth-secondary,
.auth-link-button {
  border: 0;
  cursor: pointer;
}

.auth-primary {
  min-height: 46px;
  padding: 11px 16px;
  border-radius: 9px;
  color: white;
  background: var(--ink);
  font-weight: 650;
  transition: opacity 150ms ease, transform 150ms ease;
}

.auth-primary:hover {
  opacity: 0.9;
}

.auth-primary:active {
  transform: translateY(1px);
}

.auth-primary:disabled,
.auth-secondary:disabled {
  cursor: wait;
  opacity: 0.55;
}

.auth-secondary {
  min-height: 38px;
  padding: 8px 13px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  color: var(--ink-soft);
  background: var(--card);
  font-weight: 600;
}

.auth-secondary:hover {
  background: #f3f4f6;
}

.auth-message {
  margin: 0;
  color: #176a43;
  font-size: 13px;
  line-height: 1.45;
}

.auth-message.error {
  color: #b42318;
}

.auth-footnote {
  margin: 24px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
}

.account-topbar {
  display: flex;
  width: min(1120px, calc(100% - 40px));
  min-height: 74px;
  align-items: center;
  justify-content: space-between;
  margin: 0 auto;
  border-bottom: 1px solid var(--line);
}

.account-actions {
  display: flex;
  align-items: center;
  gap: 20px;
}

.account-actions a,
.auth-link-button {
  color: var(--muted);
  background: transparent;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}

.account-actions a:hover,
.auth-link-button:hover {
  color: var(--ink);
}

.account-shell {
  display: grid;
  width: min(900px, calc(100% - 40px));
  margin: 58px auto 100px;
  gap: 24px;
}

.account-intro {
  margin-bottom: 12px;
}

.auth-notice {
  padding: 14px 16px;
  border: 1px solid #f0c36d;
  border-radius: 10px;
  color: #7a4b00;
  background: #fff8e7;
  font-size: 14px;
}

.account-panel {
  display: grid;
  grid-template-columns: minmax(180px, 0.8fr) minmax(300px, 1.2fr);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  gap: 38px;
}

.account-panel h2 {
  margin: 0;
  font-size: 18px;
  letter-spacing: -0.02em;
}

.compact-form {
  max-width: 420px;
}

.admin-panel {
  display: block;
}

.create-user-form {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 150px auto;
  align-items: end;
  margin-top: 26px;
  gap: 12px;
}

.temporary-credential {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  margin-top: 20px;
  padding: 16px;
  border: 1px solid rgba(51, 126, 169, 0.3);
  border-radius: 10px;
  background: rgba(51, 126, 169, 0.06);
  gap: 12px;
}

.temporary-credential > div {
  grid-column: 1 / -1;
}

.temporary-credential p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.temporary-credential code {
  overflow: auto;
  padding: 8px 10px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.8);
  font-family: var(--font-mono);
  font-size: 13px;
}

.users-list {
  display: grid;
  margin-top: 24px;
  border-top: 1px solid var(--line);
}

.user-row {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) 120px auto auto;
  align-items: center;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
  gap: 14px;
}

.user-identity {
  min-width: 0;
}

.user-identity strong,
.user-identity span {
  display: block;
}

.user-identity span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.user-active {
  display: flex;
  align-items: center;
  color: var(--ink-soft);
  font-size: 13px;
  gap: 7px;
}

.user-actions {
  display: flex;
  gap: 7px;
}

@media (max-width: 720px) {
  .auth-card {
    padding: 30px 24px;
  }

  .account-panel {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .create-user-form,
  .user-row {
    grid-template-columns: 1fr;
  }

  .account-topbar {
    width: min(100% - 28px, 1120px);
  }

  .account-shell {
    width: min(100% - 28px, 900px);
    margin-top: 38px;
  }
}
