:root {
  --ax-font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  --ax-color-bg: #f5f7fb;
  --ax-color-surface: #ffffff;
  --ax-color-text: #172033;
  --ax-color-muted: #667085;
  --ax-color-border: #d0d5dd;
  --ax-color-primary: #2457d6;
  --ax-color-primary-text: #ffffff;
  --ax-color-danger: #b42318;
  --ax-color-danger-bg: #fef3f2;
  --ax-color-focus: #84adff;

  --ax-radius-sm: 10px;
  --ax-radius-md: 16px;
  --ax-radius-lg: 24px;

  --ax-shadow-panel: 0 24px 70px rgba(16, 24, 40, 0.12);

  --ax-space-1: 4px;
  --ax-space-2: 8px;
  --ax-space-3: 12px;
  --ax-space-4: 16px;
  --ax-space-5: 20px;
  --ax-space-6: 24px;
  --ax-space-8: 32px;
}

* {
  box-sizing: border-box;
}

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

body.ax-page {
  margin: 0;
  font-family: var(--ax-font-family);
  color: var(--ax-color-text);
  background: var(--ax-color-bg);
}

.ax-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: var(--ax-space-6);
}

.ax-panel {
  width: min(100%, 440px);
  background: var(--ax-color-surface);
  border: 1px solid var(--ax-color-border);
  border-radius: var(--ax-radius-lg);
  box-shadow: var(--ax-shadow-panel);
  padding: var(--ax-space-8);
}

.ax-brand {
  display: flex;
  align-items: center;
  gap: var(--ax-space-4);
  margin-bottom: var(--ax-space-6);
}

.ax-brand__logo-wrap {
  flex: 0 0 auto;
}

.ax-brand__logo {
  display: block;
  max-width: 160px;
  max-height: 64px;
  object-fit: contain;
}

.ax-brand__copy {
  min-width: 0;
}

.ax-brand__name {
  margin: 0;
  font-size: 1.5rem;
  line-height: 1.2;
}

.ax-brand__subtitle {
  margin: var(--ax-space-1) 0 0;
  color: var(--ax-color-muted);
  font-size: 0.95rem;
}

.ax-form {
  display: grid;
  gap: var(--ax-space-4);
}

.ax-field {
  display: grid;
  gap: var(--ax-space-2);
}

.ax-field__label {
  font-size: 0.9rem;
  font-weight: 600;
}

.ax-field__input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--ax-color-border);
  border-radius: var(--ax-radius-md);
  padding: 0 var(--ax-space-4);
  background: var(--ax-color-surface);
  color: var(--ax-color-text);
  font: inherit;
  outline: none;
}

.ax-field__input:focus {
  border-color: var(--ax-color-focus);
  box-shadow: 0 0 0 4px rgba(132, 173, 255, 0.22);
}

.ax-field--error .ax-field__input {
  border-color: var(--ax-color-danger);
}

.ax-field__error {
  margin: 0;
  color: var(--ax-color-danger);
  font-size: 0.85rem;
}

.ax-button {
  position: relative;
  width: 100%;
  min-height: 50px;
  border: 0;
  border-radius: var(--ax-radius-md);
  padding: 0 var(--ax-space-5);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.ax-button--primary {
  background: var(--ax-color-primary);
  color: var(--ax-color-primary-text);
}

.ax-button:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

.ax-button__spinner {
  display: none;
  width: 16px;
  height: 16px;
  margin-left: var(--ax-space-2);
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  vertical-align: middle;
  animation: ax-spin 0.7s linear infinite;
}

.ax-button[aria-busy="true"] .ax-button__spinner {
  display: inline-block;
}

.ax-feedback {
  margin-bottom: var(--ax-space-4);
  border-radius: var(--ax-radius-md);
  padding: var(--ax-space-3) var(--ax-space-4);
  font-size: 0.9rem;
}

.ax-feedback--error {
  color: var(--ax-color-danger);
  background: var(--ax-color-danger-bg);
}

.ax-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--ax-space-3);
  margin-top: var(--ax-space-5);
}

.ax-actions__link {
  color: var(--ax-color-primary);
  font-size: 0.9rem;
  text-decoration: none;
}

.ax-actions__link:hover,
.ax-actions__link:focus-visible {
  text-decoration: underline;
}

.ax-footer {
  display: flex;
  flex-direction: column;
  gap: var(--ax-space-1);
  margin-top: var(--ax-space-6);
  color: var(--ax-color-muted);
  font-size: 0.8rem;
  text-align: center;
}

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

@media (max-width: 640px) {
  .ax-shell {
    align-items: stretch;
    padding: 0;
  }

  .ax-panel {
    width: 100%;
    min-height: 100dvh;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    padding: var(--ax-space-6) var(--ax-space-5);
  }

  .ax-brand {
    margin-top: auto;
  }

  .ax-footer {
    margin-top: auto;
    padding-top: var(--ax-space-8);
  }
}

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

/* AX-F4 — Access template compositions */

.ax-panel--basic {
  max-width: 420px;
}

.ax-panel--branded {
  max-width: 440px;
}

.ax-cover {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(420px, 0.85fr);
  width: 100%;
}

.ax-cover__visual {
  min-height: 100%;
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  background-color: var(--ax-color-bg);
}

.ax-cover__content {
  display: grid;
  place-items: center;
  padding: var(--ax-space-8);
  background: var(--ax-color-bg);
}

.ax-panel--cover {
  width: min(100%, 460px);
}

.ax-panel--operational {
  width: min(100%, 520px);
}

.ax-form--operational .ax-field__input,
.ax-panel--operational .ax-button {
  min-height: 60px;
  font-size: 1.05rem;
}

.ax-panel--kiosk {
  width: min(100%, 620px);
  text-align: center;
}

.ax-form--kiosk {
  gap: var(--ax-space-5);
}

.ax-form--kiosk .ax-field__input,
.ax-panel--kiosk .ax-button {
  min-height: 68px;
  font-size: 1.15rem;
}

.ax-panel--kiosk .ax-brand {
  justify-content: center;
}

@media (max-width: 900px) {
  .ax-cover {
    grid-template-columns: 1fr;
  }

  .ax-cover__visual {
    min-height: 220px;
  }

  .ax-cover__content {
    padding: var(--ax-space-5);
  }
}

@media (max-width: 640px) {
  .ax-cover__visual {
    min-height: 180px;
  }

  .ax-cover__content {
    padding: 0;
  }

  .ax-panel--cover,
  .ax-panel--operational,
  .ax-panel--kiosk,
  .ax-panel--basic,
  .ax-panel--branded {
    width: 100%;
    max-width: none;
    min-height: 100%;
  }
}
