/* app/static/css/login.css — в стиле основной оболочки */
:root {
  --brand-light: #4ba3d9;
  --brand-mid: #2b6cb0;
  --brand-dark: #1a3a7a;
  --text: #1b2a4a;
  --text-muted: #6b7a90;
  --surface: #ffffff;
  --input-bg: #f4f7fb;
  --border: #d5dee9;
  --radius: 3px;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  --font: "Source Sans 3", "Segoe UI", sans-serif;
  --header-bg: #3c8dbc;
}

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

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  color: var(--text);
  font-size: 14px;
}

body {
  min-height: 100vh;
  background: #ecf0f5;
}

.auth-bg {
  position: fixed;
  inset: 0;
  background-color: #ecf0f5;
  background-image: var(--bg-image);
  background-size: cover;
  background-position: center;
  z-index: 0;
  opacity: 0;
  transition: opacity 1.6s ease;
}

.auth-bg.is-visible {
  opacity: 1;
}

.auth-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(34, 45, 50, 0.35);
}

.auth-wrap {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  position: relative;
  width: min(420px, 100%);
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  /* top padding clears absolute version link so title keeps full row width */
  padding: 28px 28px 22px;
  border: 1px solid var(--border);
}

.auth-brand {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
}

.auth-logo {
  max-width: 180px;
  max-height: 64px;
  width: auto;
  height: auto;
  object-fit: contain;
}

.auth-title {
  margin: 0 0 8px;
  text-align: center;
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--brand-dark);
  display: block;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  float: none;
}

.auth-title-prefix {
  display: block;
  width: 100%;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.01em;
}

.auth-title-prefix[hidden] {
  display: none !important;
}

.auth-title-name {
  display: block;
  width: 90%;
  max-width: 90%;
  margin: 2px auto 0;
  box-sizing: border-box;
  float: none;
  font-size: 3.66rem; /* стартовый; JS подгоняет под ~90% ширины карточки */
  line-height: 1.15;
  font-weight: 700;
  color: var(--brand-dark);
  white-space: nowrap;
  overflow: hidden;
  text-align: center;
}

.auth-subtitle {
  margin: 0 0 22px;
  text-align: center;
  font-size: 0.92rem;
  line-height: 1.45;
  color: var(--text-muted);
  font-weight: 500;
}

.auth-check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 2px 0 6px;
  font-size: 0.88rem;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}

.auth-check input {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--header-bg);
  cursor: pointer;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.auth-form[hidden] {
  display: none !important;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 4px;
}

.field-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

.field-input {
  width: 100%;
  height: 40px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: var(--radius);
  padding: 0 12px;
  font: inherit;
  font-size: 0.95rem;
  color: var(--text);
  outline: none;
}

.field-input.is-invalid {
  border-color: #c53030;
  background: #fff8f8;
}

.field-input:focus {
  border-color: var(--header-bg);
  box-shadow: 0 0 0 2px rgba(60, 141, 188, 0.2);
  background: #fff;
}

.field-input.is-invalid:focus {
  border-color: #c53030;
  box-shadow: 0 0 0 2px rgba(197, 48, 48, 0.15);
}

.field-hint {
  display: block;
  min-height: 1.25rem;
  height: 1.25rem;
  line-height: 1.25rem;
  font-size: 0.78rem;
  color: #9b1c1c;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.form-message {
  display: block;
  min-height: 2.2rem;
  height: 2.2rem;
  margin: 4px 0 8px;
  padding: 0 2px;
  line-height: 1.25rem;
  font-size: 0.88rem;
  color: #9b1c1c;
  text-align: center;
  overflow: hidden;
}

.btn-primary {
  margin-top: 0;
  width: 100%;
  border: 1px solid #367fa9;
  border-radius: var(--radius);
  padding: 10px 16px;
  font: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  color: #fff;
  cursor: pointer;
  background: var(--header-bg);
}

.btn-primary:hover {
  background: #367fa9;
}

.btn-primary:active {
  background: #2e6b90;
}

.btn-primary:disabled {
  opacity: 0.65;
  cursor: wait;
}

.auth-footer {
  margin-top: 22px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.75rem;
  line-height: 1.4;
}

.auth-footer p {
  margin: 0;
}

.auth-version-link {
  position: absolute;
  top: 10px;
  right: 12px;
  z-index: 2;
  max-width: none;
  float: none;
  font-size: 0.7rem;
  font-weight: 500;
  line-height: 1.2;
  color: var(--text-muted);
  text-decoration: none;
  opacity: 0.75;
  /* out of flow — must not shrink .auth-title horizontal space */
  pointer-events: auto;
}

.auth-version-link:hover {
  opacity: 1;
  color: var(--brand-mid);
  text-decoration: underline;
}

@media (max-width: 480px) {
  .auth-card {
    padding: 22px 16px 18px;
  }

  .auth-title-name {
    font-size: 3.24rem; /* стартовый max; JS подгоняет под ширину */
  }

  .auth-title-prefix {
    font-size: 0.85rem;
  }
}
