:root {
  color-scheme: light;
  --brand-dark: #153653;
  --brand-deeper: #102d49;
  --primary: #0d4a8e;
  --primary-hover: #083d79;
  --accent: #2b9fe8;
  --page: #ffffff;
  --text: #152f4d;
  --muted: #62728a;
  --line: #cdd9e8;
  --field: #ffffff;
  --field-focus: #eaf2ff;
  --danger: #c93434;
  --success: #177a50;
  --shadow: rgba(16, 45, 73, 0.14);
  --focus: rgba(43, 159, 232, 0.18);
}

body.dark-mode {
  color-scheme: dark;
  --page: #0f1d2c;
  --text: #edf5ff;
  --muted: #adbbcf;
  --line: #31465f;
  --field: #172a40;
  --field-focus: #203a58;
  --shadow: rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
}

body {
  margin: 0;
  height: 100vh;
  overflow: hidden;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--text);
  background: var(--page);
}

.app {
  width: 100%;
  height: 100vh;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  background: var(--page);
}

.brand-panel,
.auth-panel {
  height: 100vh;
}

.brand-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  padding: clamp(32px, 5vw, 72px);
  background: linear-gradient(145deg, var(--brand-dark) 0%, var(--brand-deeper) 100%);
}

.brand-logo {
  display: block;
  width: min(76%, 560px);
  max-height: 72vh;
  object-fit: contain;
  filter: brightness(0) invert(1);
}

.auth-panel {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(46px, 6vh, 66px) clamp(58px, 8vw, 104px) clamp(40px, 5vh, 58px);
  background: var(--page);
}

.auth-ring {
  position: absolute;
  width: clamp(166px, 24vh, 218px);
  height: clamp(166px, 24vh, 218px);
  top: clamp(32px, 5vh, 48px);
  right: clamp(42px, 5vw, 64px);
  border: clamp(22px, 3.4vh, 30px) solid rgba(13, 74, 142, 0.06);
  border-radius: 999px;
  pointer-events: none;
}

.theme-toggle {
  position: absolute;
  top: 22px;
  right: 28px;
  width: 50px;
  height: 26px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--field);
  cursor: pointer;
  box-shadow: 0 8px 22px var(--shadow);
  z-index: 2;
}

.theme-toggle-dot {
  display: block;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: var(--primary);
  transition: transform 0.18s ease;
}

body.dark-mode .theme-toggle-dot {
  transform: translateX(24px);
}

.auth-content {
  position: relative;
  z-index: 1;
  width: min(100%, 520px);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.auth-kicker {
  margin: 0 0 clamp(10px, 1.6vh, 14px);
  color: #1970bf;
  font-size: clamp(12px, 1.8vh, 15px);
  font-weight: 800;
  letter-spacing: 3px;
  text-transform: uppercase;
}

.view h2 {
  margin: 0 0 clamp(10px, 1.6vh, 14px);
  color: var(--text);
  font-size: clamp(36px, min(3.1vw, 6vh), 50px);
  line-height: 1.03;
  font-weight: 800;
  letter-spacing: 0;
}

.lead {
  margin: 0 0 clamp(18px, 2.8vh, 26px);
  max-width: 560px;
  color: var(--muted);
  font-size: clamp(15px, 2.2vh, 18px);
  line-height: 1.42;
}

.field {
  margin-bottom: clamp(10px, 1.7vh, 14px);
}

label {
  display: block;
  margin-bottom: 8px;
  color: var(--text);
  font-size: clamp(13px, 1.8vh, 15px);
  font-weight: 800;
}

input {
  width: 100%;
  min-height: clamp(50px, 7.1vh, 58px);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 13px 18px;
  font: inherit;
  font-size: clamp(15px, 2.2vh, 18px);
  color: var(--text);
  background: var(--field);
  outline: none;
}

input::placeholder {
  color: #95a3b5;
}

input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--focus);
  background: var(--field-focus);
}

.password-wrap {
  position: relative;
}

.password-wrap input {
  padding-right: 58px;
}

.password-rules {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px 14px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
}

.password-rules li {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.password-rules span {
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border-radius: 999px;
  background: var(--danger);
}

.password-rules li.valid span {
  background: var(--success);
}

.icon-button {
  position: absolute;
  right: 12px;
  top: 50%;
  width: 34px;
  height: 34px;
  transform: translateY(-50%);
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #6d8198;
  cursor: pointer;
  font-size: 18px;
}

.icon-button:hover,
.icon-button:focus {
  background: rgba(13, 74, 142, 0.08);
  color: var(--text);
  outline: none;
}

.form-options {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin: 0 0 clamp(14px, 2.2vh, 20px);
}

.remember-option {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  color: var(--muted);
  font-size: clamp(13px, 1.8vh, 14px);
  font-weight: 700;
}

.remember-option input {
  width: 18px;
  min-height: 18px;
  height: 18px;
  padding: 0;
  accent-color: var(--primary);
}

.error {
  min-height: 15px;
  margin-top: 5px;
  color: var(--danger);
  font-size: 12px;
  line-height: 1.35;
}

.error.with-icon {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.error.with-icon::before {
  content: "!";
  width: 15px;
  height: 15px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 15px;
  border-radius: 999px;
  background: var(--danger);
  color: #ffffff;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
}

.error:empty::before {
  display: none;
}

.login-error {
  min-height: 0;
  margin: 0 0 12px;
}

.login-error:empty {
  margin: 0;
}

.success {
  display: none;
  margin: 0 0 16px;
  padding: 12px 14px;
  border: 1px solid rgba(24, 121, 78, 0.28);
  border-radius: 11px;
  background: rgba(24, 121, 78, 0.08);
  color: var(--success);
  line-height: 1.4;
  font-size: 13px;
}

.success.visible {
  display: block;
}

.primary-button,
.register-button {
  width: 100%;
  min-height: clamp(50px, 7vh, 58px);
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  font: inherit;
  font-size: clamp(15px, 2.1vh, 17px);
  font-weight: 800;
}

.primary-button {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 16px 26px rgba(13, 74, 142, 0.14);
}

.primary-button:hover,
.primary-button:focus,
.register-button:hover,
.register-button:focus {
  background: var(--primary-hover);
  outline: none;
}

.register-button {
  margin-top: clamp(10px, 1.8vh, 14px);
  background: #1f72df;
  color: #ffffff;
}

.text-button {
  border: 0;
  padding: 0;
  background: transparent;
  color: #1970bf;
  cursor: pointer;
  font: inherit;
  font-size: clamp(13px, 1.9vh, 15px);
  font-weight: 800;
}

.text-button:hover,
.text-button:focus {
  color: var(--primary-hover);
  text-decoration: underline;
  outline: none;
}

.secure-note {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: clamp(16px, 2.6vh, 24px);
  padding: clamp(12px, 1.8vh, 15px) 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: clamp(12px, 1.7vh, 13px);
}

.secure-note span {
  width: 14px;
  height: 14px;
  border: 4px solid rgba(36, 164, 104, 0.18);
  border-radius: 999px;
  background: #2aaa70;
}

.secure-note p {
  margin: 0;
}

.form-footer {
  margin-top: 16px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.copyright {
  position: absolute;
  right: clamp(58px, 8vw, 104px);
  bottom: 18px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 1120px) {
  .auth-panel {
    padding: 56px 46px 42px;
  }
}

@media (min-width: 861px) and (max-height: 760px) {
  .brand-logo {
    width: min(68%, 480px);
    max-height: 62vh;
  }

  .copyright {
    font-size: 11px;
  }

  .auth-panel {
    padding-top: 42px;
    padding-bottom: 34px;
  }

  .auth-content {
    width: min(100%, 500px);
  }

  .auth-kicker {
    margin-bottom: 8px;
    font-size: 12px;
  }

  .view h2 {
    margin-bottom: 8px;
    font-size: 36px;
  }

  .lead {
    margin-bottom: 15px;
    font-size: 14px;
  }

  .field {
    margin-bottom: 8px;
  }

  .password-rules {
    gap: 3px 12px;
    margin-top: 6px;
    font-size: 11px;
  }

  label {
    margin-bottom: 5px;
    font-size: 13px;
  }

  input,
  .primary-button,
  .register-button {
    min-height: 46px;
    font-size: 15px;
  }

  input {
    padding-top: 10px;
    padding-bottom: 10px;
  }

  .form-options {
    margin-bottom: 11px;
  }

  .register-button {
    margin-top: 9px;
  }

  .secure-note {
    margin-top: 12px;
    padding-top: 10px;
    padding-bottom: 10px;
  }

  .auth-ring {
    width: 150px;
    height: 150px;
    border-width: 20px;
  }
}

@media (max-width: 860px) {
  body {
    height: auto;
    overflow: auto;
  }

  .app {
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }

  .app {
    grid-template-columns: 1fr;
  }

  .brand-panel,
  .auth-panel {
    height: auto;
    min-height: 50vh;
  }

  .brand-panel {
    padding: 34px 28px;
  }

  .brand-logo {
    width: min(72%, 420px);
    max-height: 36vh;
  }

  .lead {
    font-size: 17px;
  }

  .auth-panel {
    align-items: flex-start;
    flex-direction: column;
    padding: 72px 28px 56px;
  }

  .copyright {
    position: static;
    margin: 30px 28px 20px;
  }
}

@media (max-width: 560px) {
  .brand-logo {
    width: min(80%, 360px);
  }

  .view h2 {
    font-size: 40px;
  }

  input,
  .primary-button,
  .register-button {
    min-height: 58px;
    font-size: 16px;
  }

  .form-options {
    align-items: flex-start;
    flex-direction: column;
  }
}
