:root {
  --auth-bg: #07111f;
  --auth-panel: rgba(13, 27, 45, 0.96);
  --auth-border: rgba(125, 211, 252, 0.2);
  --auth-text: #edf7ff;
  --auth-muted: #93a9bd;
  --auth-accent: #38bdf8;
  --auth-accent-strong: #0284c7;
  --auth-danger: #fb7185;
  --auth-success: #4ade80;
}

.auth-login-page {
  min-height: 100vh;
  margin: 0;
  color: var(--auth-text);
  background:
    radial-gradient(circle at 20% 15%, rgba(14, 165, 233, 0.18), transparent 36rem),
    radial-gradient(circle at 85% 80%, rgba(20, 184, 166, 0.12), transparent 30rem),
    var(--auth-bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.auth-login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  box-sizing: border-box;
}

.auth-login-card {
  width: min(100%, 420px);
  padding: 38px;
  box-sizing: border-box;
  border: 1px solid var(--auth-border);
  border-radius: 24px;
  background: var(--auth-panel);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(18px);
}

.auth-brand-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin-bottom: 24px;
  border-radius: 15px;
  color: #04121e;
  background: linear-gradient(135deg, #7dd3fc, #2dd4bf);
  font-size: 24px;
  font-weight: 900;
}

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

.auth-login-card h1 {
  margin: 0;
  font-size: clamp(28px, 7vw, 38px);
  line-height: 1.08;
}

.auth-login-copy {
  margin: 14px 0 26px;
  color: var(--auth-muted);
  line-height: 1.55;
}

.auth-login-form,
.auth-user-create-form,
.auth-password-form {
  display: grid;
  gap: 16px;
}

.auth-login-form label,
.auth-user-create-form label,
.auth-password-form label {
  display: grid;
  gap: 7px;
  color: var(--auth-muted);
  font-size: 13px;
  font-weight: 700;
}

.auth-login-form input,
.auth-user-create-form input,
.auth-user-create-form select,
.auth-user-row select,
.auth-password-form input {
  min-height: 46px;
  box-sizing: border-box;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 12px;
  padding: 0 13px;
  color: var(--auth-text);
  background: rgba(2, 10, 20, 0.72);
  font: inherit;
  outline: none;
}

.auth-login-form input:focus,
.auth-user-create-form input:focus,
.auth-user-create-form select:focus,
.auth-user-row select:focus,
.auth-password-form input:focus {
  border-color: var(--auth-accent);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.12);
}

.auth-login-form button,
.auth-primary-button {
  min-height: 48px;
  border: 0;
  border-radius: 12px;
  color: #03131f;
  background: linear-gradient(135deg, #7dd3fc, #2dd4bf);
  font-weight: 900;
  cursor: pointer;
}

.auth-login-form button:disabled,
.auth-primary-button:disabled {
  opacity: 0.58;
  cursor: wait;
}

.auth-form-status {
  min-height: 21px;
  margin: 16px 0 0;
  color: var(--auth-danger);
  font-size: 13px;
  line-height: 1.45;
}

.auth-form-status[data-kind="pending"] { color: var(--auth-muted); }
.auth-form-status[data-kind="success"] { color: var(--auth-success); }

.auth-bootstrap-help {
  margin-top: 18px;
  padding: 14px;
  border: 1px solid rgba(251, 191, 36, 0.25);
  border-radius: 12px;
  color: #fde68a;
  background: rgba(120, 53, 15, 0.16);
  font-size: 12px;
  line-height: 1.5;
}

.auth-bootstrap-help strong,
.auth-bootstrap-help span { display: block; }
.auth-bootstrap-help code { overflow-wrap: anywhere; }

.auth-session-bar {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 9000;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: calc(100vw - 28px);
  padding: 8px;
  border: 1px solid var(--auth-border);
  border-radius: 14px;
  color: var(--auth-text);
  background: rgba(5, 15, 27, 0.92);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(15px);
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
}

.auth-session-person { min-width: 0; padding: 0 5px; }
.auth-session-name { display: block; overflow: hidden; font-size: 12px; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.auth-session-role { display: block; color: var(--auth-muted); font-size: 10px; }

.auth-session-button,
.auth-secondary-button,
.auth-danger-button {
  min-height: 34px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 9px;
  padding: 0 11px;
  color: var(--auth-text);
  background: rgba(30, 41, 59, 0.78);
  font: inherit;
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
}

.auth-danger-button { color: #fecdd3; border-color: rgba(251, 113, 133, 0.34); }
.auth-session-button:hover,
.auth-secondary-button:hover { border-color: var(--auth-accent); }
.auth-danger-button:hover { border-color: var(--auth-danger); }

.auth-dialog {
  width: min(760px, calc(100vw - 28px));
  max-height: min(820px, calc(100vh - 28px));
  box-sizing: border-box;
  border: 1px solid var(--auth-border);
  border-radius: 20px;
  padding: 0;
  color: var(--auth-text);
  background: #0b1829;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.55);
}

.auth-dialog::backdrop { background: rgba(1, 6, 14, 0.78); backdrop-filter: blur(4px); }
.auth-dialog-body { padding: 24px; overflow: auto; }
.auth-dialog-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.auth-dialog-header h2 { margin: 0 0 5px; font-size: 24px; }
.auth-dialog-header p { margin: 0; color: var(--auth-muted); font-size: 13px; }
.auth-dialog-close { width: 36px; min-width: 36px; padding: 0; font-size: 20px; }
.auth-section-title { margin: 26px 0 12px; font-size: 15px; }
.auth-user-create-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.auth-user-list { display: grid; gap: 10px; }
.auth-user-row { display: grid; grid-template-columns: minmax(150px, 1fr) 145px auto auto; align-items: center; gap: 10px; padding: 12px; border: 1px solid rgba(148, 163, 184, 0.16); border-radius: 12px; background: rgba(2, 10, 20, 0.42); }
.auth-user-identity { min-width: 0; }
.auth-user-identity strong,
.auth-user-identity span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.auth-user-identity span { margin-top: 3px; color: var(--auth-muted); font-size: 11px; }
.auth-user-actions { display: flex; gap: 7px; }
.auth-enabled-label { display: flex; align-items: center; gap: 6px; color: var(--auth-muted); font-size: 12px; white-space: nowrap; }
.auth-password-panel { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; align-items: end; padding-top: 6px; }
.auth-password-panel[hidden] { display: none; }
.auth-password-panel label { display: grid; gap: 5px; color: var(--auth-muted); font-size: 11px; }

@media (max-width: 680px) {
  .auth-login-card { padding: 28px 22px; }
  .auth-session-person { display: none; }
  .auth-user-create-grid { grid-template-columns: 1fr; }
  .auth-user-row { grid-template-columns: 1fr 1fr; }
  .auth-user-identity { grid-column: 1 / -1; }
  .auth-password-panel { grid-template-columns: 1fr; }
}
