/* Auth — DSM tokens + MUI Outlined form pattern */
:root {
  --wh-color-primary: #0059cb;
  --wh-color-primary-hover: #003e9e;
  --wh-color-primary-subtle: #e8eefc;
  --wh-color-primary-focus: rgba(0, 89, 203, 0.25);
  --wh-color-accent: #fc0065;

  --wh-frame-bg: #f5f7fa;
  --wh-surface: #ffffff;
  --wh-border: rgba(0, 0, 0, 0.23);
  --wh-border-hover: rgba(0, 0, 0, 0.87);
  --wh-border-subtle: #e2e7ed;
  --wh-divider: rgba(0, 0, 0, 0.12);
  --wh-text: rgba(0, 0, 0, 0.87);
  --wh-text-muted: rgba(0, 0, 0, 0.6);
  --wh-text-subtle: rgba(0, 0, 0, 0.38);
  --wh-color-danger: #b42624;
  --wh-color-success: #189062;
  --wh-color-warning: #c54e14;

  --wh-alert-error-bg: #fdeded;
  --wh-alert-error-color: #5f2120;
  --wh-alert-success-bg: #edf7ed;
  --wh-alert-success-color: #1e4620;
  --wh-alert-warning-bg: #fff4e5;
  --wh-alert-warning-color: #663c00;

  --wh-font-primary: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --wh-spacing-2xs: 4px;
  --wh-spacing-xs: 8px;
  --wh-spacing-md: 16px;
  --wh-spacing-lg: 24px;
  --wh-spacing-2xl: 32px;

  --wh-radius-xs: 4px;
  --wh-radius-md: 8px;
  --wh-radius-xl: 12px;
  --wh-field-min-h: 60px;
  --wh-field-pad-y: 18.5px;
  --wh-field-pad-x: 14px;

  --wh-shell-w: 30rem;

  --wh-elevation-dialog: 0 8px 24px rgba(0, 0, 0, 0.12), 0 4px 8px rgba(0, 0, 0, 0.08);

  --sl-color-primary-500: #0059cb;
  --sl-color-primary-600: #003e9e;
  --sl-color-danger-600: var(--wh-color-danger);
  --sl-color-success-600: #189062;
  --sl-font-sans: var(--wh-font-primary);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  font-family: var(--wh-font-primary);
  font-size: 1rem;
  line-height: 1.5;
  background: var(--wh-frame-bg);
  color: var(--wh-text);
  -webkit-font-smoothing: antialiased;
}

.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100%;
  min-height: 100dvh;
  padding: var(--wh-spacing-lg) var(--wh-spacing-md);
}

.login-shell {
  width: var(--wh-shell-w);
  max-width: 100%;
}

/* Brand above login panel */
.login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: var(--wh-spacing-lg);
}

.login-brand__logo {
  display: block;
  width: min(240px, 100%);
  height: auto;
}

.login-brand__name {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.login-brand__mark {
  color: var(--wh-color-accent);
}

.login-panel {
  background: var(--wh-surface);
  border: 1px solid var(--wh-border-subtle);
  border-radius: var(--wh-radius-md);
  box-shadow: var(--wh-elevation-dialog);
  overflow: hidden;
}

.login-panel__header {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: var(--wh-spacing-lg) var(--wh-spacing-lg) var(--wh-spacing-md);
}

.login-panel__title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.02em;
  color: var(--wh-text);
}

.login-panel__lead {
  margin: var(--wh-spacing-xs) 0 0;
  max-width: 22rem;
  font-size: 0.9375rem;
  font-weight: 400;
  line-height: 1.5;
  color: var(--wh-text-muted);
}

.login-panel__body {
  padding: var(--wh-spacing-md) var(--wh-spacing-lg) var(--wh-spacing-2xl);
}

.login-panel__social {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--wh-spacing-2xs);
}

.login-panel__hint {
  margin: 0;
  text-align: center;
  font-size: 0.75rem;
  line-height: 1.66;
  color: var(--wh-text-subtle);
}

.login-divider {
  display: flex;
  align-items: center;
  gap: var(--wh-spacing-md);
  margin: var(--wh-spacing-lg) 0;
  color: var(--wh-text-subtle);
  font-size: 0.8125rem;
  line-height: 1;
}

.login-divider::before,
.login-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--wh-divider);
}

.login-divider__text {
  flex-shrink: 0;
  text-transform: lowercase;
}

.login-panel__intro {
  margin: 0 0 var(--wh-spacing-md);
  font-size: 0.9375rem;
  font-weight: 400;
  line-height: 1.5;
  color: var(--wh-text-muted);
}

/* —— MUI Alert (standard) —— */
.wh-alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: var(--wh-spacing-md);
  padding: 6px 16px;
  border-radius: var(--wh-radius-xs);
  font-size: 0.875rem;
  font-weight: 400;
  line-height: 1.43;
  letter-spacing: 0.01071em;
}

.wh-alert[hidden] {
  display: none;
}

.wh-alert__icon {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  margin: 7px 0;
  opacity: 0.9;
}

.wh-alert__icon .wh-mui-svg-icon {
  width: 22px;
  height: 22px;
}

.wh-alert__message {
  flex: 1 1 auto;
  min-width: 0;
  margin: 8px 0;
  padding: 0;
}

.wh-alert__close {
  flex-shrink: 0;
  width: auto;
  height: auto;
  margin: 4px -6px 4px 0;
  padding: 5px;
  color: inherit;
  opacity: 0.7;
}

.wh-alert__close:hover {
  opacity: 1;
}

.wh-alert__close .wh-mui-svg-icon {
  width: 20px;
  height: 20px;
}

.wh-alert--error {
  color: var(--wh-alert-error-color);
  background-color: var(--wh-alert-error-bg);
}

.wh-alert--error .wh-alert__icon {
  color: var(--wh-color-danger);
}

.wh-alert--success {
  color: var(--wh-alert-success-color);
  background-color: var(--wh-alert-success-bg);
}

.wh-alert--success .wh-alert__icon {
  color: var(--wh-color-success);
}

.wh-alert--warning {
  color: var(--wh-alert-warning-color);
  background-color: var(--wh-alert-warning-bg);
}

.wh-alert--warning .wh-alert__icon {
  color: var(--wh-color-warning);
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: var(--wh-spacing-md);
}

.login-form__actions {
  display: flex;
  flex-direction: column;
  gap: var(--wh-spacing-xs);
  padding-top: var(--wh-spacing-xs);
}

.login-form__actions .wh-btn--contained {
  width: 100%;
}

.login-panel__secondary {
  margin: var(--wh-spacing-lg) 0 0;
  text-align: center;
}

/* —— MUI Outlined TextField —— */
.wh-field {
  display: flex;
  flex-direction: column;
  width: 100%;
}

.wh-field__control {
  position: relative;
  box-sizing: border-box;
  cursor: text;
  display: inline-flex;
  align-items: center;
  width: 100%;
  min-height: var(--wh-field-min-h);
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.4375em;
  color: rgba(0, 0, 0, 0.87);
  border-radius: var(--wh-radius-xs);
  background: transparent;
}

.wh-field--adorned .wh-field__control {
  padding-right: var(--wh-field-pad-x);
}

.wh-field__input {
  font: inherit;
  letter-spacing: inherit;
  color: currentColor;
  padding: var(--wh-field-pad-y) var(--wh-field-pad-x);
  border: 0;
  box-sizing: content-box;
  background: none;
  height: 1.4375em;
  margin: 0;
  display: block;
  min-width: 0;
  width: 100%;
  flex: 1 1 auto;
  line-height: 1.4375em;
  outline: none;
  -webkit-tap-highlight-color: transparent;
  padding-top: 23px;
}

.wh-field--adorned .wh-field__input {
  padding-right: 0;
}

.wh-field__input::placeholder {
  color: currentColor;
  opacity: 0.42;
}

.wh-field__input:-webkit-autofill,
.wh-field__input:-webkit-autofill:hover,
.wh-field__input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px var(--wh-surface) inset;
  -webkit-text-fill-color: var(--wh-text);
  caret-color: var(--wh-text);
  transition: background-color 9999s ease-out 0s;
}

/* MuiInputAdornment-root + positionEnd */
.wh-mui-input-adornment {
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: center;
  white-space: nowrap;
  color: rgba(0, 0, 0, 0.54);
  flex-shrink: 0;
}

.wh-mui-input-adornment--end {
  margin-left: 8px;
  position: relative;
  z-index: 1;
  margin-top: 5px;
  margin-right: 5px;
}

/* MuiIconButton-root medium + edgeEnd */
.wh-mui-icon-button {
  text-align: center;
  flex: 0 0 auto;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border-radius: 50%;
  overflow: visible;
  color: rgba(0, 0, 0, 0.54);
  border: 0;
  margin: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
  background-color: transparent;
  appearance: none;
  -webkit-appearance: none;
  transition: background-color 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
}

.wh-mui-icon-button:hover {
  background-color: rgba(0, 0, 0, 0.04);
}

.wh-mui-icon-button:focus-visible {
  outline: 2px solid var(--wh-color-primary);
  outline-offset: 2px;
}

.wh-mui-icon-button--edge-end {
  margin-right: -12px;
}

/* MuiSvgIcon-root fontSize medium */
.wh-mui-svg-icon {
  user-select: none;
  width: 24px;
  height: 24px;
  display: block;
  fill: currentColor;
  flex-shrink: 0;
}

/* Label nel notch — vive nel legend, centrata nativamente sul bordo */
.wh-field__legend {
  float: unset;
  position: relative;
  z-index: 1;
  width: auto;
  max-width: calc(100% - 16px);
  padding: 0;
  margin: 0 0 0 calc(var(--wh-field-pad-x) - 8px);
  border: 0;
  font-size: 0.75rem;
  line-height: 11px;
  letter-spacing: 0.00938em;
  white-space: nowrap;
}

.wh-field__label {
  display: inline-block;
  padding: 0 4px;
  font: inherit;
  line-height: inherit;
  letter-spacing: inherit;
  color: var(--wh-text-muted);
  background: var(--wh-surface);
  pointer-events: none;
  transition: color 0.2s cubic-bezier(0, 0, 0.2, 1);
}

.wh-field__outline {
  position: absolute;
  inset: 0;
  margin: 0;
  padding: 0 8px;
  border: 1px solid var(--wh-border);
  border-radius: var(--wh-radius-xs);
  pointer-events: none;
  min-width: 0;
  transition: border-color 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.wh-field:hover:not(:focus-within):not(.is-invalid) .wh-field__outline {
  border-color: var(--wh-color-primary);
}

.wh-field:hover:not(:focus-within):not(.is-invalid) .wh-field__label {
  color: var(--wh-color-primary);
}

.wh-field:focus-within:not(.is-invalid) .wh-field__outline {
  border-color: var(--wh-color-primary);
}

.wh-field:focus-within:not(.is-invalid) .wh-field__label {
  color: var(--wh-color-primary);
}

.wh-field.is-filled:not(:focus-within):not(.is-invalid) .wh-field__outline {
  border-color: var(--wh-color-primary);
}

.wh-field.is-filled:not(:focus-within):not(.is-invalid) .wh-field__label {
  color: var(--wh-color-primary);
}

.wh-field.is-invalid .wh-field__outline {
  border-color: var(--wh-color-danger);
}

.wh-field.is-invalid:focus-within .wh-field__outline {
  border-color: var(--wh-color-danger);
}

.wh-field.is-invalid .wh-field__label {
  color: var(--wh-color-danger);
}

.wh-field__helper {
  min-height: 1.25rem;
  margin: var(--wh-spacing-2xs) 14px 0;
  font-size: 0.75rem;
  line-height: 1.66;
  color: var(--wh-text-muted);
}

.wh-field.is-invalid .wh-field__helper {
  color: var(--wh-color-danger);
}

/* —— MUI Buttons —— */
.wh-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 64px;
  min-height: 36px;
  padding: 6px 16px;
  border: none;
  border-radius: var(--wh-radius-xs);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.75;
  letter-spacing: 0.02857em;
  text-transform: uppercase;
  cursor: pointer;
  transition:
    background-color 0.2s cubic-bezier(0.4, 0, 0.2, 1),
    box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.wh-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.wh-btn--text {
  color: var(--wh-color-primary);
  background: transparent;
  text-transform: none;
  letter-spacing: normal;
}

.wh-btn--text:hover:not(:disabled) {
  background: rgba(0, 89, 203, 0.04);
}

.wh-btn--contained {
  color: #fff;
  background: var(--wh-color-primary);
  box-shadow:
    0 3px 1px -2px rgba(0, 0, 0, 0.2),
    0 2px 2px 0 rgba(0, 0, 0, 0.14),
    0 1px 5px 0 rgba(0, 0, 0, 0.12);
  text-transform: none;
  letter-spacing: normal;
  font-size: 0.9375rem;
}

.wh-btn--contained:hover:not(:disabled) {
  background: var(--wh-color-primary-hover);
  box-shadow:
    0 2px 4px -1px rgba(0, 0, 0, 0.2),
    0 4px 5px 0 rgba(0, 0, 0, 0.14),
    0 1px 10px 0 rgba(0, 0, 0, 0.12);
}

.wh-btn--outlined {
  width: 100%;
  min-height: 42px;
  padding: 8px 16px;
  border: 1px solid var(--wh-border);
  background: var(--wh-surface);
  color: var(--wh-text);
  text-transform: none;
  letter-spacing: normal;
  font-size: 0.9375rem;
  gap: var(--wh-spacing-xs);
}

.wh-btn--outlined:hover:not(:disabled) {
  border-color: var(--wh-border-hover);
  background: rgba(0, 0, 0, 0.02);
}

.wh-btn--google:disabled {
  opacity: 0.72;
}

.wh-btn__icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.wh-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--wh-color-primary-focus);
}

.login-link {
  appearance: none;
  border: none;
  background: none;
  padding: var(--wh-spacing-xs);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--wh-color-primary);
  cursor: pointer;
  text-decoration: none;
  border-radius: var(--wh-radius-xs);
}

.login-link:hover {
  background: rgba(0, 89, 203, 0.04);
}

/* —— Reset password dialog (login page) —— */
.reset-dialog::part(overlay) {
  background: rgba(0, 0, 0, 0.5);
}

.reset-dialog::part(panel) {
  border-radius: var(--wh-radius-md);
  border: 1px solid var(--wh-border-subtle);
  background: var(--wh-surface);
  box-shadow: var(--wh-elevation-dialog);
  width: min(36rem, calc(100vw - 2 * var(--wh-spacing-lg)));
  max-width: 100%;
  padding: 0;
}

.reset-dialog::part(body) {
  padding: 0;
}

.reset-dialog__header {
  display: flex;
  align-items: center;
  gap: var(--wh-spacing-xs);
  min-height: 4rem;
  padding: var(--wh-spacing-lg) var(--wh-spacing-lg) var(--wh-spacing-md);
}

.reset-dialog__title {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: -0.01em;
  text-align: left;
  color: var(--wh-text);
}

.reset-dialog__icon-btn {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  margin: calc(-1 * var(--wh-spacing-2xs));
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--wh-text-muted);
  cursor: pointer;
}

.reset-dialog__icon-btn:hover {
  background: rgba(0, 0, 0, 0.04);
  color: var(--wh-text);
}

.reset-dialog__icon-btn:focus-visible {
  outline: 2px solid var(--wh-color-primary);
  outline-offset: 2px;
}

.reset-dialog__icon {
  width: 1.25rem;
  height: 1.25rem;
  display: block;
}

.reset-dialog__rule {
  height: 1px;
  margin: 0;
  background: var(--wh-divider);
}

.reset-dialog__content {
  padding: var(--wh-spacing-lg);
}

.reset-dialog__intro {
  margin: 0 0 var(--wh-spacing-md);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.5;
  color: var(--wh-text);
}

.reset-dialog__form {
  margin: 0;
}

.reset-dialog__footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--wh-spacing-md);
  min-height: 4rem;
  padding: var(--wh-spacing-md) var(--wh-spacing-lg) var(--wh-spacing-lg);
}

.reset-dialog__footer .wh-btn {
  min-height: 2.25rem;
  padding: var(--wh-spacing-xs) var(--wh-spacing-md);
}

.reset-dialog__footer .wh-btn--text {
  min-width: 64px;
  text-transform: none;
}

.reset-dialog__footer .wh-btn--dialog-primary {
  min-width: 7rem;
  text-transform: uppercase;
  letter-spacing: 0.02857em;
  font-size: 0.875rem;
}

@media (prefers-reduced-motion: reduce) {
  .wh-field__outline,
  .wh-field__label,
  .wh-btn,
  .wh-mui-icon-button {
    transition: none;
  }
}

@media (max-width: 480px) {
  .login-page {
    padding: var(--wh-spacing-md);
    align-items: flex-start;
  }

  .login-panel__header,
  .login-panel__body {
    padding-left: var(--wh-spacing-md);
    padding-right: var(--wh-spacing-md);
  }
}
