:root {
  color-scheme: light;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg-primary);
  color: var(--text-primary);
}

button, input { font: inherit; }

.auth-topbar {
  min-height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-5);
  padding: var(--space-2) clamp(var(--space-5), 4vw, var(--space-8));
  border-bottom: 1px solid var(--border-primary);
  background: color-mix(in srgb, var(--surface-primary) 96%, transparent);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.auth-brand img {
  width: auto;
  height: 54px;
  object-fit: contain;
}

.auth-system-status {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 38px;
  padding: 0 var(--space-4);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  background: var(--surface-primary);
  font-size: var(--fs-service);
}

.auth-system-status i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 4px var(--success-bg);
}

.auth-layout {
  width: min(1540px, 100%);
  min-height: calc(100vh - 82px);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 54%) minmax(420px, 46%);
  background: var(--surface-primary);
}

.auth-visual {
  position: relative;
  min-height: 680px;
  overflow: hidden;
  padding: clamp(var(--space-7), 6vw, var(--space-8)) clamp(var(--space-6), 5vw, var(--space-8)) var(--space-7);
  border-right: 1px solid var(--border-primary);
  background: var(--bg-warm);
  isolation: isolate;
}

.auth-visual::before {
  content: "";
  position: absolute;
  inset: 10% 2% 18% 32%;
  z-index: -2;
  opacity: .28;
  background: url("/ui/assets/hero-industrial-lineart-v1.png") center / contain no-repeat;
}

.auth-visual::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  width: 54%;
  height: 5px;
  background: var(--accent-primary);
}

.auth-visual-copy {
  position: relative;
  z-index: 2;
  max-width: 640px;
}

.auth-eyebrow {
  margin: 0 0 var(--space-4);
  color: var(--accent-text);
  font-size: var(--fs-service);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}

.auth-visual h1 {
  max-width: 680px;
  margin: 0;
  font-size: clamp(var(--fs-screen), 4.1vw, var(--fs-display));
  line-height: 1.04;
  letter-spacing: 0;
}

.auth-visual-copy > p:last-child {
  max-width: 540px;
  margin: var(--space-5) 0 0;
  color: var(--text-secondary);
  font-size: var(--fs-lead);
  line-height: 1.55;
}

.auth-worker {
  position: absolute;
  z-index: 1;
  right: -5%;
  bottom: -3%;
  width: min(58%, 560px);
  max-height: 76%;
  object-fit: contain;
  object-position: bottom right;
}

.auth-panel {
  display: flex;
  align-items: center;
  padding: clamp(var(--space-7), 6vw, var(--space-8)) clamp(var(--space-6), 5vw, var(--space-8));
  background: var(--surface-primary);
}

.auth-panel-inner {
  width: min(100%, 610px);
  margin: 0 auto;
}

.auth-panel h2 {
  margin: 0;
  font-size: clamp(var(--fs-screen), 3vw, var(--fs-large));
  line-height: 1.1;
  letter-spacing: 0;
}

.auth-lead {
  margin: var(--space-3) 0 var(--space-6);
  color: var(--text-secondary);
  font-size: var(--fs-base);
  line-height: 1.5;
}

.auth-error {
  margin: 0 0 var(--space-4);
  padding: var(--space-3) var(--space-4);
  border-left: 3px solid var(--danger);
  background: var(--danger-bg);
  color: var(--danger);
  font-size: var(--fs-base);
  line-height: 1.45;
}

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

.auth-identifier-hint {
  margin: calc(-1 * var(--space-2)) 0 0;
  color: var(--text-secondary);
  font-size: var(--fs-service);
}

.auth-form label {
  display: grid;
  gap: var(--space-2);
  color: var(--text-primary);
  font-size: var(--fs-service);
  font-weight: 750;
}

.auth-form input {
  width: 100%;
  min-height: 54px;
  padding: 0 var(--space-4);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  outline: none;
  color: var(--text-primary);
  background: var(--surface-primary);
  transition: border-color .16s ease, box-shadow .16s ease;
}

.auth-form input:focus {
  border-color: var(--accent-text);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-primary) 12%, transparent);
}

.auth-form input[aria-invalid="true"] { border-color: var(--danger); }

.auth-form small {
  min-height: 16px;
  color: var(--text-muted);
  font-size: var(--fs-service);
  font-weight: 500;
  line-height: 1.35;
}

.auth-form small.is-error { color: var(--danger); }

.password-field { position: relative; display: block; }

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

.password-field button {
  position: absolute;
  top: 50%;
  right: 8px;
  min-height: 44px;
  padding: 0 var(--space-2);
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: var(--fs-base);
  font-weight: 700;
  transform: translateY(-50%);
}

.auth-primary {
  width: min(100%, 360px);
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin-top: var(--space-1);
  padding: 0 var(--space-5);
  border: 1px solid var(--accent-primary);
  border-radius: var(--radius-md);
  background: var(--accent-primary);
  color: var(--text-on-accent);
  cursor: pointer;
  font-size: var(--fs-base);
  font-weight: 800;
  box-shadow: 0 10px 24px color-mix(in srgb, var(--accent-active) 13%, transparent);
}

.auth-primary:hover { background: var(--accent-hover); }

/* "Подождите…" is content, not just a locked action -- on a slow shop-floor
   connection this can sit for several seconds, and opacity composited the
   whole orange fill with its text together, same failure as the video
   button. Swap the fill instead of dimming it. */
.auth-primary:disabled {
  cursor: wait;
  opacity: 1;
  border-color: var(--border-primary);
  background: var(--bg-secondary);
  color: var(--text-primary);
  box-shadow: none;
}

.auth-fields-two {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
}

.auth-field-wide { grid-column: 1 / -1; }

.auth-setup-note {
  display: grid;
  gap: var(--space-1);
  padding: var(--space-4) var(--space-4);
  border-left: 3px solid var(--success);
  background: var(--success-bg);
  color: var(--success);
  font-size: var(--fs-service);
  line-height: 1.4;
}

.auth-help {
  display: grid;
  gap: var(--space-2);
  margin-top: var(--space-5);
}

.auth-help p {
  margin: 0;
  color: var(--text-secondary);
  font-size: var(--fs-base);
  line-height: 1.5;
}

.auth-verify-link {
  display: inline-flex;
  color: var(--text-secondary);
  font-size: var(--fs-base);
  text-underline-offset: 4px;
}

[hidden] { display: none !important; }

@media (max-width: 1080px) {
  .auth-layout { grid-template-columns: minmax(0, 45%) minmax(480px, 55%); }
  .auth-visual { padding-inline: var(--space-6); }
  .auth-worker { width: 76%; right: -22%; opacity: .88; }
}

@media (max-width: 820px) {
  .auth-topbar { min-height: 72px; padding: var(--space-2) var(--space-5); }
  .auth-brand img { height: 46px; }
  .auth-layout { min-height: calc(100vh - 72px); grid-template-columns: 1fr; }
  .auth-visual { min-height: 300px; padding: var(--space-7) var(--space-5) var(--space-6); border-right: 0; border-bottom: 1px solid var(--border-primary); }
  .auth-visual::before { inset: 2% -6% 0 28%; }
  .auth-visual h1 { max-width: 72%; }
  .auth-visual-copy > p:last-child { max-width: 65%; margin-top: var(--space-4); }
  .auth-worker { right: -2%; bottom: -15%; width: 38%; height: 108%; opacity: 1; }
  .auth-panel { padding: var(--space-7) var(--space-5) var(--space-8); }
}

@media (max-width: 560px) {
  .auth-system-status { padding-inline: var(--space-3); }
  .auth-brand { gap: var(--space-1); }
  .auth-brand img { height: 40px; }
  .auth-visual { min-height: 250px; padding: var(--space-6) var(--space-5); }
  .auth-visual h1 { max-width: 100%; padding-right: 74px; }
  .auth-visual-copy > p:last-child { max-width: 100%; padding-right: 104px; }
  .auth-worker { right: -20%; width: 60%; opacity: .62; }
  .auth-panel { padding: var(--space-6) var(--space-5) var(--space-7); }
  .auth-fields-two { grid-template-columns: 1fr; }
  .auth-field-wide { grid-column: auto; }
  .auth-primary { width: 100%; }
}

@media (max-width: 360px) {
  .auth-topbar { padding-inline: var(--space-4); }
  .auth-system-status { font-size: 0; min-width: 38px; justify-content: center; }
  .auth-visual h1 { padding-right: 42px; }
  .auth-visual-copy > p:last-child { padding-right: 48px; }
  .auth-panel { padding-inline: var(--space-4); }
}
