:root {
  --page: #f7f9fc;
  --surface: #ffffff;
  --surface-muted: #f8fafc;
  --text: #101828;
  --text-soft: #344054;
  --muted: #667085;
  --muted-light: #98a2b3;
  --border: #d8e1ee;
  --border-soft: #eef2f7;
  --brand: #ff9800;
  --brand-dark: #e68600;
  --green: #16a34a;
  --shadow-card: 0 18px 46px rgba(16, 24, 40, .075);
  --shadow-focus: 0 0 0 4px rgba(255, 152, 0, .14);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--page);
}

body {
  min-height: 100vh;
  margin: 0;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    linear-gradient(180deg, #ffffff 0%, #f7f9fc 48%, #f1f5f9 100%),
    linear-gradient(90deg, rgba(255, 152, 0, .08), rgba(37, 99, 235, .04));
  letter-spacing: 0;
}

a {
  color: inherit;
}

button,
input {
  font: inherit;
  letter-spacing: 0;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 36px;
}

.login-shell {
  width: min(100%, 1080px);
  min-height: min(760px, calc(100vh - 72px));
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 28px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  width: fit-content;
  min-width: 0;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  background: #111827;
  color: #fff;
  font-size: 13px;
  font-weight: 900;
  box-shadow: 0 12px 28px rgba(17, 24, 39, .16);
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.brand-text strong {
  color: var(--text);
  font-size: 18px;
  line-height: 1;
  font-weight: 900;
}

.brand-text span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1;
  font-weight: 800;
  text-transform: uppercase;
}

.login-content {
  display: grid;
  grid-template-columns: minmax(0, .94fr) minmax(390px, 440px);
  align-items: center;
  gap: clamp(42px, 7vw, 96px);
}

.system-panel {
  max-width: 560px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.panel-label {
  width: fit-content;
  max-width: 100%;
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 11px;
  border: 1px solid rgba(255, 152, 0, .22);
  border-radius: 999px;
  background: rgba(255, 152, 0, .08);
  color: #b75f00;
  font-size: 11px;
  line-height: 1;
  font-weight: 900;
  text-transform: uppercase;
}

.system-panel h1 {
  margin: 0;
  color: var(--text);
  font-size: clamp(38px, 4.2vw, 56px);
  line-height: 1.04;
  font-weight: 800;
  max-width: 520px;
}

.system-panel p {
  margin: 0;
  max-width: 510px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.75;
  font-weight: 600;
}

.auth-panel {
  min-width: 0;
}

.auth-card {
  width: 100%;
  border: 1px solid rgba(216, 225, 238, .96);
  border-radius: 8px;
  background: rgba(255, 255, 255, .97);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.auth-head {
  padding: 30px 30px 20px;
  border-bottom: 1px solid var(--border-soft);
  background: #fff;
}

.auth-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid rgba(22, 163, 74, .20);
  border-radius: 999px;
  background: rgba(22, 163, 74, .08);
  color: #166534;
  font-size: 11px;
  line-height: 1;
  font-weight: 900;
  text-transform: uppercase;
}

.auth-badge::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(22, 163, 74, .11);
}

.auth-head h2 {
  margin: 18px 0 7px;
  color: var(--text);
  font-size: 28px;
  line-height: 1.14;
  font-weight: 900;
}

.auth-head p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
  font-weight: 600;
}

.auth-body {
  padding: 24px 30px 30px;
  background: linear-gradient(180deg, #fff 0%, #fbfdff 100%);
}

.message {
  display: none;
  margin: 0 0 14px;
  padding: 11px 12px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.45;
  font-weight: 800;
}

.err {
  border: 1px solid rgba(220, 38, 38, .18);
  background: #fef2f2;
  color: #991b1b;
}

.ok {
  border: 1px solid rgba(22, 163, 74, .18);
  background: #f0fdf4;
  color: #166534;
}

.form {
  display: grid;
  gap: 14px;
}

.field {
  display: grid;
  gap: 7px;
}
#mfaField[hidden] { display: none; }

.field label {
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1;
  font-weight: 900;
}

.input-box {
  position: relative;
  display: flex;
  align-items: center;
}

.input-box input {
  width: 100%;
  height: 50px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 0 14px;
  font-size: 14px;
  font-weight: 700;
  outline: none;
  transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}

.input-box input::placeholder {
  color: var(--muted-light);
  font-weight: 600;
}

.input-box input:focus {
  border-color: rgba(255, 152, 0, .78);
  box-shadow: var(--shadow-focus);
  background: #fff;
}

.input-box input.password-input {
  padding-right: 88px;
}

.password-toggle {
  position: absolute;
  right: 8px;
  width: auto;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-muted);
  color: #475467;
  font-size: 11px;
  line-height: 1;
  font-weight: 900;
  cursor: pointer;
}

.password-toggle:focus-visible,
.submit-button:focus-visible {
  outline: 3px solid rgba(255, 152, 0, .22);
  outline-offset: 2px;
}

.submit-button {
  width: 100%;
  height: 51px;
  margin-top: 4px;
  border: 0;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  font-size: 14px;
  line-height: 1;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 14px 30px rgba(255, 152, 0, .22);
  transition: transform .16s ease, box-shadow .16s ease, opacity .16s ease, background .16s ease;
}

.submit-button:hover {
  background: var(--brand-dark);
  transform: translateY(-1px);
  box-shadow: 0 15px 30px rgba(255, 152, 0, .24);
}

.submit-button:active {
  transform: translateY(0);
}

.submit-button[disabled] {
  opacity: .68;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.submit-content {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
}

.submit-spinner {
  display: none;
  width: 15px;
  height: 15px;
  border: 2px solid rgba(255, 255, 255, .42);
  border-top-color: #fff;
  border-radius: 999px;
  animation: spin .72s linear infinite;
}

.submit-button.is-loading .submit-spinner {
  display: inline-block;
}

.submit-arrow {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  background: rgba(255, 255, 255, .18);
  font-size: 14px;
  line-height: 1;
}

.submit-button.is-loading .submit-arrow {
  display: none;
}

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

.auth-note {
  margin-top: 14px;
  min-height: 18px;
  color: var(--muted);
  text-align: center;
  font-size: 12px;
  line-height: 1.45;
  font-weight: 700;
}

.legal-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  font-weight: 700;
}

.legal-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
}

.legal-links a {
  color: #475467;
  text-decoration: none;
  font-weight: 800;
}

.legal-links a:hover {
  color: var(--brand-dark);
}

@media (max-width: 900px) {
  .login-page {
    padding: 26px 22px;
    place-items: start center;
  }

  .login-shell {
    min-height: calc(100vh - 52px);
    gap: 24px;
  }

  .login-content {
    grid-template-columns: 1fr;
    gap: 28px;
    align-items: start;
  }

  .system-panel {
    max-width: 720px;
    gap: 12px;
  }

  .system-panel h1 {
    max-width: 680px;
    font-size: 36px;
    line-height: 1.05;
  }

  .system-panel p {
    max-width: 620px;
    font-size: 14px;
  }

  .auth-panel {
    width: min(100%, 440px);
  }

  .legal-card {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 560px) {
  body {
    background: #f8fafc;
  }

  .login-page {
    padding: 20px 16px;
  }

  .login-shell {
    min-height: calc(100vh - 40px);
    gap: 20px;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
  }

  .system-panel h1 {
    font-size: 31px;
  }

  .system-panel p {
    font-size: 13px;
    line-height: 1.65;
  }

  .auth-head,
  .auth-body {
    padding-left: 20px;
    padding-right: 20px;
  }

  .auth-head h2 {
    font-size: 24px;
  }

  .legal-links {
    gap: 8px 12px;
  }
}
