* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: Arial, sans-serif;
  background: linear-gradient(180deg, #eef4ff 0%, #dfe9fb 100%);
  color: #0f172a;
}

body {
  min-height: 100vh;
}

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 430px;
  background: #ffffff;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.14);
  padding: 34px 30px 30px;
}

.login-logo-wrap {
  text-align: center;
  margin-bottom: 28px;
}

.login-logo {
  font-size: 32px;
  font-weight: 700;
  color: #16336f;
  letter-spacing: 0.3px;
  margin-bottom: 8px;
}

.login-subtitle {
  font-size: 15px;
  color: #64748b;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  font-size: 14px;
  font-weight: 600;
  color: #334155;
}

.form-group input {
  width: 100%;
  height: 48px;
  border: 1px solid #d7deea;
  border-radius: 12px;
  padding: 0 14px;
  font-size: 15px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-group input:focus {
  border-color: #16336f;
  box-shadow: 0 0 0 4px rgba(22, 51, 111, 0.10);
}

#loginSubmit {
  margin-top: 4px;
  width: 100%;
  height: 50px;
  border: 0;
  border-radius: 12px;
  background: #16336f;
  color: #ffffff;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.05s ease;
}

#loginSubmit:hover {
  background: #1d428f;
}

#loginSubmit:active {
  transform: translateY(1px);
}

#loginSubmit:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.login-alert {
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 14px;
  line-height: 1.4;
}

.login-alert.error {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.login-alert.success {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.hidden {
  display: none;
}

/* ============================================================
   TERMS CHECKBOX
   ============================================================ */
.terms-checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  padding: 4px 0;
}

.terms-checkbox {
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  margin: 2px 0 0 0;
  cursor: pointer;
  accent-color: #16336f;
}

.terms-checkbox-text {
  flex: 1 1 auto;
  font-size: 14px;
  line-height: 1.45;
  color: #334155;
}

.terms-link {
  color: #16336f;
  text-decoration: underline;
  text-decoration-color: rgba(22, 51, 111, 0.5);
  text-underline-offset: 2px;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
}

.terms-link:hover {
  color: #1d428f;
  text-decoration-color: #1d428f;
}

/* ============================================================
   TERMS MODAL
   ============================================================ */
.terms-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.terms-modal.hidden {
  display: none;
}

.terms-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  cursor: pointer;
}

.terms-modal-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 560px;
  background: #ffffff;
  border-radius: 18px;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.25);
  padding: 26px 26px 22px;
  max-height: calc(100dvh - 48px);
  display: flex;
  flex-direction: column;
}

.terms-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  gap: 12px;
}

.terms-modal-header h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: #16336f;
  line-height: 1.3;
}

.terms-modal-close {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  border: 0;
  background: #f1f5f9;
  border-radius: 10px;
  color: #475569;
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.terms-modal-close:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.terms-modal-content {
  flex: 1 1 auto;
  overflow-y: auto;
  font-size: 15px;
  line-height: 1.6;
  color: #334155;
  padding: 4px 2px;
}

.terms-modal-content p {
  margin: 0 0 12px 0;
}

.terms-modal-content p:last-child {
  margin-bottom: 0;
}

.terms-modal-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 18px;
}

.terms-modal-close-btn {
  height: 42px;
  padding: 0 22px;
  border: 0;
  border-radius: 10px;
  background: #16336f;
  color: #ffffff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}

.terms-modal-close-btn:hover {
  background: #1d428f;
}

.remember-me-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  padding: 2px 0;
}

.remember-me-checkbox {
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  margin: 0;
  cursor: pointer;
  accent-color: #16336f;
}

.remember-me-text {
  font-size: 14px;
  line-height: 1.45;
  color: #334155;
  font-weight: 500;
}

/* ===== СОГЛАШЕНИЕ ===== */
.terms-modal-content h3 {
  margin-top: 24px;
  margin-bottom: 10px;
  font-size: 1.05em;
  color: #fff;
}

.terms-modal-content h3:first-child {
  margin-top: 0;
}

.terms-modal-content p {
  margin: 8px 0;
  line-height: 1.5;
}

.terms-modal-content ul {
  margin: 8px 0 12px 0;
  padding-left: 20px;
}

.terms-modal-content ul li {
  margin: 4px 0;
  line-height: 1.5;
}

.terms-modal-content a {
  color: #4ea3ff;
  text-decoration: underline;
}

.terms-modal-content .terms-edition,
.terms-modal-content .terms-city {
  text-align: center;
  font-style: italic;
  margin: 4px 0;
}

.terms-tariff-table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 0.95em;
}

.terms-tariff-table th,
.terms-tariff-table td {
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 8px 12px;
  text-align: left;
}

.terms-tariff-table th {
  background: rgba(255, 255, 255, 0.08);
  font-weight: 600;
}

@media (max-width: 480px) {
  .terms-modal {
    padding: 16px;
  }

  .terms-modal-card {
    padding: 22px 18px 18px;
    border-radius: 14px;
    max-height: calc(100dvh - 32px);
  }

  .terms-modal-header h2 {
    font-size: 18px;
  }

  .terms-modal-content {
    font-size: 14px;
  }
}

@media (max-width: 480px) {
  .login-card {
    padding: 26px 18px 22px;
    border-radius: 16px;
  }

  .login-logo {
    font-size: 28px;
  }
}